https://wiki.octave.org/wiki/api.php?action=feedcontributions&user=Cdf&feedformat=atomOctave - User contributions [en]2020-08-04T02:40:29ZUser contributionsMediaWiki 1.34.1https://wiki.octave.org/wiki/index.php?title=Projects&diff=12637Projects2020-02-04T10:08:22Z<p>Cdf: /* Matlab-compatible ODE solvers in core-Octave */</p>
<hr />
<div>The list below summarizes features or bug fixes we would like to see in Octave. if you start working steadily on a project, please let octave-maintainers@octave.org know. We might have information that could help you. You should also read the [[Contribution guidelines |Contributing Guidelines]].<br />
<br />
This list is not exclusive -- there are many other things that might be good projects, but it might instead be something we already have. Also, some of the following items may not actually be considered good ideas now. So please check with octave-maintainers@octave.org before you start working on some large project.<br />
<br />
Summer of Code students, please also see [[SoC Project Ideas]].<br />
<br />
If you're looking for small project, something more suited to start getting involved with Octave development or to fill a boring evening, see [[short projects]]<br />
<br />
=Numerical=<br />
<br />
* Use C++11 <random> libraries for random number generation. Write link between Octave functions (rand, randi, randn, rande) and C++ API. Implement RandStream objects as Matlab does.<br />
<br />
*Improve logm, and sqrtm (see this thread: http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html)<br />
<br />
*Use pairwise addition in sum() to mitigate against numerical errors without substantial performance penalty (https://en.wikipedia.org/wiki/Pairwise_summation).<br />
<br />
*Review implementing algorithm in this 2009 paper (https://epubs.siam.org/doi/pdf/10.1137/080738490) for xsum (sum with extra accuracy). The existing implementation uses a 2005 paper.<br />
<br />
*Improve complex mapper functions. See W. Kahan, ``Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit (in The State of the Art in Numerical Analysis, eds. Iserles and Powell, Clarendon Press, Oxford, 1987) for explicit trigonometric formulae. See {{patch|8172}} for a previous attempt.<br />
<br />
*Make functions like gamma() return the right IEEE Inf or NaN values for extreme args or other undefined cases.<br />
<br />
*Improve sqp.<br />
<br />
*Fix CollocWt? to handle Laguerre polynomials. Make it easy to extend it to other polynomial types.<br />
<br />
*Add optional arguments to colloc so that it's not restricted to Legendre polynomials.<br />
<br />
*Move rand, eye, xpow, xdiv, etc., functions to the matrix classes.<br />
<br />
*Improve design of ODE, DAE, classes.<br />
<br />
*Make QR more memory efficient for large matrices when not all the columns of Q are required (apparently this is not handled by the lapack code yet).<br />
<br />
*Evaluate harmonics and cross-correlations of unevenly sampled and nonstationary time series, as in http://www.jstatsoft.org/v11/i02 (which has C code with interface to R). (This is now partly implemented in the [http://octave.sourceforge.net/lssa/index.html lssa] package.)<br />
<br />
<!-- == General purpose Finite Element library ==<br />
<br />
Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes,<br />
namely the [[bim package]] which relies on the [http://octave.sf.net/msh msh package] (which is in turn based on [http://geuz.org/gmsh/ gmsh]) for creating and managing 2D triangular and 3D tetrahedral meshes and on the [http://octave.sf.net/fpl fpl package] for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with [http://www.paraview.org Paraview] or [https://wci.llnl.gov/codes/visit/ 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.<br />
The [http://geopdes.sf.net GeoPDEs] project, on the other hand, offers a complete suite of functions for discretizing a wide range of<br />
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 [http://geopdes.sf.net 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 [http://fenicsproject.org/documentation/ FEniCS] based on the existing C++ or Python interfaces. This second approach has been developed during the GSOC 2013 and the Octave-Forge package [http://octave.sf.net/fem-fenics fem-fenics] is now available. However, fem-fenics could be extended in many different ways:<br />
* implement the bindings for the UFL language inside Octave<br />
* add new functions already available with Fenics but not yet in Octave<br />
* create new functions specifically suited for Octave<br />
* improve the efficiency of the code<br />
The main goal for the fem-fenics package is ultimately to be merged with the FEnics project itself, so that it can remain in-sync with the main library development. --><br />
<br />
== Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D ==<br />
<br />
The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function <tt>pdepe</tt>. A good starting point is the [http://en.wikipedia.org/wiki/Method_of_lines method of lines] for which you can find more details [http://en.wikibooks.org/wiki/Partial_Differential_Equations/Method_of_Lines here] and [http://www.scholarpedia.org/article/Method_of_lines here], whereas an example implementation can be found [http://www.scholarpedia.org/article/Method_of_Lines/Example_Implementation here]. In addition, [http://www.pdecomp.net/ this page] provides some useful material.<br />
<br />
== Implement solver for 1D nonlinear boundary value problems ==<br />
<br />
The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package<br />
by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver.<br />
Details on the methods to be implemented can be found in [http://dx.doi.org/10.1145/502800.502801 this paper] on bvp4c and [http://www.jnaiam.net/new/uploads/files/014dde86eef73328e7ab674d1a32aa9c.pdf this paper] on bvp5c. Further details are available in [http://books.google.it/books/about/Nonlinear_two_point_boundary_value_probl.html?id=s_pQAAAAMAAJ&redir_esc=y this book].<br />
<br />
<!-- == Geometric integrators for Hamiltonian Systems ==<br />
<br />
[http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration Geometric (AKA Symplectic) integrators] are useful for <br />
multi-dimensional classical mechanics problems and for molecular dynamics simulations.<br />
The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently<br />
specifically suited for second order problems in general and Hamiltonian systems in particular.<br />
Therefore a new package for geometric integrators would be a useful contribution.<br />
This could be created as new package or added as a set of new functions for odepkg.<br />
The function interface should be consistent throughout the package and should be modeled to follow <br />
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.<br />
An initial list of methods to be implemented includes (but is not limited to)<br />
* Symplectic Euler methods, see [http://en.wikipedia.org/wiki/Semi-implicit_Euler_method here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Störmer-Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Velocity Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Symplectic partitioned Runge-Kutta methods, see [http://reference.wolfram.com/mathematica/tutorial/NDSolveSPRK.html here] or [http://dx.doi.org/10.1137/0733019 here]<br />
* Spectral Variational Integrator methods, see [http://www3.nd.edu/~izaguirr/papers/acta_numerica.pdf here] or [http://www.math.ucsd.edu/~mleok/pdf/HaLe2012_SVI.pdf here]<br />
<br />
For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker.<br />
Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.<br />
* SHAKE, see [http://en.wikipedia.org/wiki/Constraint_algorithm here] or [http://dx.doi.org/10.1016/0021-9991(77)90098-5 here]<br />
* RATTLE, see [http://dx.doi.org/10.1016/0021-9991(83)90014-1 here] or [http://dx.doi.org/10.1002/jcc.540161003 here]<br />
--><br />
<br />
== Matlab-compatible ODE solvers in core-Octave ==<br />
<br />
* <strike> 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. </strike><br />
* <strike> Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core. </strike><br />
* <strike> Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [https://savannah.gnu.org/patch/?8102 here] 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. </strike><br />
* Improve handling of sparse Jacobians in IDE/DAE solvers<br />
** Currently, in the IDA wrapper function __ode15__ an over conservative guess for the amount of memory to be allocated when assembling a sparse jacobian is used, essentially allocating enough space for a full jacobian then freeing the excess memory, an initial patch for fixing this has been posted on the tracker, for integrating this into Octave it must be generalized to support prior versions of SUNDIALS<br />
** Currently Jacobians passed by the user in Octave's sparse matrix format are copied into SUNDIALS own sparse matrix format. Newer versions of SUNDIALS (5.x or higher) support letting the user take care of the linear algebra data structures and methods thus removing the need for the copy. Taking advantage of this feature would improve the solver performance both in terms of memory footprint and speed.<br />
** References<br />
***[https://savannah.gnu.org/bugs/?func=detailitem&item_id=55905 tracker post about memory allocation] <br />
***[https://computing.llnl.gov/projects/sundials/release-history SUNDIALS release history]<br />
* Implement Matlab compatible versions of "deval".<br />
* Complete transition of ode23s into core Octave<br />
** [https://savannah.gnu.org/bugs/?57309 Bug tracker entry discussing ode23s]<br />
<br />
== High Precision Arithmetic Computation ==<br />
<br />
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-conditioned. 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<br />
<br />
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.<br />
<br />
=GUI/IDE=<br />
<br />
*Søren Hauberg has suggested that we need C++ code that can:<br />
**Determine if a line of code could be fully parsed, i.e. it would return true for "plot (x, y);", but false for "while (true)".<br />
**Evaluate a line of code and return the output as a string (it would be best if it could provide three strings: output, warnings and errors).<br />
**Query defined variables, i.e. get a list of currently defined variables. Bonus points if it could tell you if anything had changed since the last time you checked the variables (could also be done with signals).<br />
* Create a better (G)UI for the {{manual|profile|profiler}}. This may be done with Qt, but not necessarily.<br />
<br />
== GUI Variable Editor and Property Inspector ==<br />
<br />
Octave has a preliminary implementation of a Variable Editor: a spreadsheet-like tool for quickly editing and visualizing variables. The initial phase of the project will be learning how the implementation was done.<br />
<br />
With the knowledge gained, the second part of the project will be to implement a Property Inspector. This is a spreadsheet like interface to the many, many graphics properties that exist and are different on a per-object basis. The goal would be not only the concise-display of the existing properties, but a reasonable user interface to change them. As examples, Boolean properties should be able to be toggled with a double-click; Radio properties should have a drop-down list of only the supported options; Other properties that can be modified should have the constraints built-in (for example, Linewidth must be a scalar, while Position must be a 1x4 vector). It would also be important to have easy access to the documentation of a property.<br />
<br />
For reference, Matlab has a similar Property Inspector (https://www.mathworks.com/help/matlab/ref/inspect.html).<br />
<br />
== Sisotool. Create a graphical design tool for tuning closed loop control system ([[Control package]])==<br />
<br />
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.<br />
Recently, some implementation was done during [[Summer_of_Code#GSoC_2018|GSoC 2018]], see https://eriveltongualter.github.io/GSoC2018/final.html for details.<br />
<br />
=Sparse Matrices=<br />
<br />
The paper by [http://arxiv.org/abs/cs.MS/0604006 Bateman & Adler] is good reading for understanding the sparse matrix implementation.<br />
<br />
*Improve Matlab compatibility for {{manual|sprandsym}}.<br />
<br />
*Sparse logical indexing in idx_vector class so that something like <code>a = sprandn (1e6, 1e6, 1e-6); a(a<1) = 0;</code> won't cause a memory overflow.<br />
<br />
*Other missing Functions<br />
**lsqr<br />
**minres<br />
**symmlq<br />
<br />
== SPQR Interface ==<br />
<br />
Octave implements QR factorization for sparse matrices, but it does so with an older "CXSPARSE" library. This has caused fundamental issues, including segfaults as recorded here (bugs {{bug|51950}} and {{bug|57033}}). The goal of this project is to program an interface to the API for the SQPR library (http://faculty.cse.tamu.edu/davis/suitesparse.html). This is the same library that Matlab uses for this purpose.<br />
<br />
*Improve QR factorization functions, using idea based on CSPARSE cs_dmsol.m<br />
<br />
*Improve QR factorization by replacing CXSPARSE code with SPQR code, and make the linear solve return 2-norm solutions for ill-conditioned matrices based on this new code<br />
<br />
=Strings=<br />
<br />
*Consider making octave_print_internal() print some sort of text representation for unprintable characters instead of sending them directly to the terminal. (But don't do this for fprintf!)<br />
<br />
*Consider changing the default value of `string_fill_char' from SPC to NUL.<br />
<br />
=Other Data Types=<br />
<br />
*Template functions for mixed-type ops.<br />
<br />
*Convert other functions for use with the floating point type including quad, dasrt, daspk, etc.<br />
<br />
=Input/Output=<br />
<br />
*Make fread and fwrite work for complex data. Iostreams based versions of these functions would also be nice, and if you are working on them, it would be good to support other size specifications (integer*2, etc.).<br />
<br />
*Move some pr-output stuff to liboctave.<br />
<br />
*Make the cutoff point for changing to packed storage a user-preference variable with default value 8192.<br />
<br />
*Complain if there is not enough disk space available (I think there is simply not enough error checking in the code that handles writing data).<br />
<br />
*Make it possible to tie arbitrary input and output streams together, similar to the way iostreams can be tied together.<br />
<br />
*Expand {{codeline|imwrite}} options. This shouldn't be too hard to implement, since it's wrapped around GraphicsMagick.<br />
<br />
*Extend Octave functions to work on stored arrays that are too big to fit in RAM, similar to available R [http://www.bigmemory.org/ packages.]<br />
<br />
* write {{codeline|xmlread}} and {{codeline|xmlwrite}}. This could be done using [http://xerces.apache.org/xerces-c/ Xerces C++ interface] which apparently is what [http://octave.1599824.n4.nabble.com/xml-in-octave-td4663034.html Matlab uses].<br />
<br />
* Implement hdf5 for .mat files (see [http://octave.1599824.n4.nabble.com/Reading-Matlab-td4650158.html this thread]).<br />
<br />
=Interpreter=<br />
<br />
The interpreter is written in C++, undocumented. There are many possible projects associated with it.<br />
<br />
'''Required skills''': ''Very good'' C and C++ knowledge, possibly also understanding of [http://en.wikipedia.org/wiki/Gnu_bison GNU bison] and [http://en.wikipedia.org/wiki/Flex_lexical_analyser 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.<br />
<br />
*Allow customization of the debug prompt.<br />
<br />
*Fix the parser so that<br />
<br />
if (expr) 'this is a string' end<br />
<br />
is parsed as IF expr STRING END. ''(see [https://lists.gnu.org/archive/html/octave-maintainers/2014-03/msg00087.html this] post on the mailing list)''<br />
<br />
*Clean up functions in input.cc that handle user input (there currently seems to be some unnecessary duplication of code and it seems overly complex).<br />
<br />
*Consider allowing an arbitrary property list to be attached to any variable. This could be a more general way to handle the help string that can currently be added with `document'.<br />
<br />
*Allow more command line options to be accessible as built-in variables (--echo-commands, etc.).<br />
<br />
*Make the interpreter run faster.<br />
<br />
*Allow arbitrary lower bounds for array indexing.<br />
<br />
*Improve performance of recursive function calls.<br />
<br />
*Improve the way ignore_function_time_stamp works to allow selecting by individual directories or functions.<br />
<br />
*Add a command-line option to tell Octave to just do syntax checking and not execute statements.<br />
<br />
*Clean up symtab and variable stuff.<br />
<br />
*Input stream class for parser files -- must manage buffers for flex and context for global variable settings.<br />
<br />
*make parser do more semantic checking, continue after errors when compiling functions, etc.<br />
<br />
*Make LEXICAL_ERROR have a value that is the error message for parse_error() to print?<br />
<br />
*Add a run-time alias mechanism that would allow things like alias fun function_with_a_very_long_name so that `function_with_a_very_long_name' could be invoked as `fun'.<br />
<br />
*Allow local changes to variables to be written more compactly than is currently possible with unwind_protect. For example, <br />
<br />
function f ()<br />
local prefer_column_vectors = something;<br />
...<br />
endfunction<br />
<br />
<br />
would be equivalent to<br />
<br />
function f ()<br />
save_prefer_column_vectors = prefer_column_vectors;<br />
unwind_protect<br />
prefer_column_vectors = something;<br />
...<br />
unwind_protect_cleanup<br />
prefer_column_vectors = save_prefer_column_vectors;<br />
end_unwind_protect<br />
endfunction<br />
<br />
<br />
*Fix all function files to check for bogus inputs (wrong number or types of input arguments, wrong number of output arguments).<br />
<br />
*Handle options for built-in functions more consistently.<br />
<br />
*Too much time is spent allocating and freeing memory. What can be done to improve performance?<br />
<br />
Use move constructors rather than copy constructors for things like dim_vectors which are repeatedly created just to initialize Array or Matrix objects.<br />
<br />
*Error output from Fortran code is ugly. Something should be done to make it look better.<br />
<br />
*It would be nice if output from the Fortran routines could be passed through the pager.<br />
<br />
*Attempt to recognize common subexpressions in the parser.<br />
<br />
*Consider making it possible to specify an empty matrix with a syntax like [](e1, e2). Of course at least one of the expressions must be zero...<br />
<br />
*Is Matrix::fortran_vec() really necessary?<br />
<br />
*Rewrite whos and the symbol_record_info class. Write a built-in function that gives all the basic information, then write who and whos as M-files.<br />
<br />
*On systems that support matherr(), make it possible for users to enable the printing of warning messages.<br />
<br />
*Make it possible to mark variables and functions as read-only.<br />
<br />
*Make it possible to write a function that gets a reference to a matrix in memory and change one or more elements without generating a second copy of the data.<br />
<br />
*Use nanosleep instead of usleep if it is available? Apparently nanosleep is to be preferred over usleep on Solaris systems.<br />
<br />
*<strike>Per the following discussion, allow bsxfun style singleton dimension expansion as the default behavior for the builtin element-wise operators: http://octave.1599824.n4.nabble.com/Vector-approach-to-row-margin-frequencies-tp1636361p1636367.html</strike> This is done. <strike>Now [[User:JordiGH|I]] just have to document it.</strike> This is done too!<br />
<br />
== Improve JIT compiling ==<br />
<br />
Octave's interpreter is ''very'' slow on some loops. Recently, thanks to Max Brister's work, an initial implementation of a just-in-time compiler (JITC) in [http://llvm.org 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. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation. See also [[JIT]].<br />
<br />
== Improve memory management ==<br />
<br />
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.<br />
<br />
== Implement classdef classes ==<br />
<br />
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 classdef classes in version 4.0, refer to the [[Classdef|classdef status page]] for what is not yet implemented. There is irregular work here, and classdef is [http://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html a very] [http://www.mathworks.com/help/matlab/events-sending-and-responding-to-messages.html complicated] [http://www.mathworks.com/help/matlab/enumeration-classes.html 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.<br />
<br />
Although there's already a substantial classdef support in current octave code base, there are still many areas that are unimplemented or need improvements. The main ones that come to my mind are:<br />
* support for events<br />
* support for enums<br />
* support for "import" (this requires good understanding of octave internals, especially the symbol table)<br />
* improving multiple inheritance and method resolution<br />
* honoring and computing "Sealed" attribute<br />
* support for function handle to methods<br />
<br />
== Improve MPI package ==<br />
<br />
Octave Forge's [http://octave.sourceforge.net/mpi/index.html MPI package] <br />
is a wrapper for basic MPI functions for parallel computing. It is implemented <br />
by wrapping MPI function calls in simple DLD functions that map Octave's Datataypes to <br />
MPI Derived Datatypes. <br />
The proposed project deals with improving and extending the Octave MPI package, for example:<br />
* Octave MPI applications can currently be only run in batch mode, add the ability to launch parallel jobs and collect their output in an interactive Octave session.<br />
* Implement functions for non-blocking communication (MPI_Isend, MPI_Irecv)<br />
* Implement one-to-many (Broadcast, Scatter), many-to-one (Reduce, Gather), and many-to-many (All Reduce, Allgather) communication routines<br />
<br />
=Graphics=<br />
<br />
*Correctly handle case where DISPLAY is unset. Provide --no-window-system or --nodisplay (?) option. Provide --display=DISPLAY option? How will this work with gnuplot (i.e., how do we know whether gnuplot requires an X display to display graphics)?<br />
<br />
* Implement transparency and lighting in OpenGL backend(s). A basic implementation was available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of octave.<br />
<br />
* Implement a Cairo-based renderer for 2D-only graphics, with support for PS/PDF/SVG output (for printing).<br />
<br />
* On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.<br />
<br />
* Add map-creating capabilities similar to the Matlab [http://www.mathworks.com/help/map/functionlist.html Mapping toolbox] for inclusion in the Octave Forge [https://sourceforge.net/p/octave/mapping mapping package].<br />
<br />
* Add data cursor to trace data values in figure.<br />
<br />
== Lighting ==<br />
<br />
Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.<br />
<br />
== Object selection in OpenGL renderer ==<br />
<br />
This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [http://glprogramming.com/red/chapter13.html]<br />
<br />
== Non-OpenGL renderer ==<br />
<br />
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:<br />
* [http://qt.nokia.com Qt]: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [https://github.com/goffioul/QtHandles]<br />
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.<br />
<br />
== TeX/LaTeX markup ==<br />
<br />
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.<br />
<br />
* 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,<br />
<br />
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre><br />
<br />
:Would be rendered as,<br />
<br />
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup><br />
<br />
:This is analogous to how special characters may be included in a wiki using html.<br />
<br />
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre><br />
<br />
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].<br />
<br />
* 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.<br />
<br />
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html 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 [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.<br />
<br />
=History=<br />
<br />
*Add an option to allow saving input from script files in the history list.<br />
<br />
*The history command should accept two numeric arguments to indicate a range of history entries to display, save or read.<br />
<br />
*Avoid writing the history file if the history list has not changed.<br />
<br />
*Avoid permission errors if the history file cannot be opened for writing.<br />
<br />
*Fix history problems — core dump if multiple processes are writing to the same history file?<br />
<br />
=Configuration and Installation=<br />
<br />
*Makefile changes:<br />
**eliminate for loops<br />
**define shell commands or eliminate them<br />
**consolidate targets<br />
<br />
*Create a docs-only distribution?<br />
<br />
*<strike> Convert build system to a non-recursive Automake setup. See how Makefile.am files currently include module.mk files in subdirectories, extend this concept to the entire project so there is only one top-level Makefile.am. </strike> Done, except for special dir libgnu which is the only SUBDIRS listed in configure.ac.<br />
<br />
=Documentation and On-Line Help=<br />
<br />
*Improve the Texinfo Documentation for the interpreter. It would be useful to have lots more examples, to not have so many forward references, and to not have very many simple lists of functions.<br />
<br />
*[[Doxygen]] documentation for the C++ classes.<br />
<br />
*Make index entries more consistent to improve behavior of <code>help -i</code>.<br />
<br />
*Make <code>help -i</code> try to find a whole word match first.<br />
<br />
*Add more demo files.<br />
<br />
*Flesh out this wiki<br />
<br />
=Tests=<br />
*Improved set of tests: [http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=370633]<br />
**Tests for various functions. Would be nice to have a test file corresponding to every function (see below)<br />
**Tests for element by element operators: + - .* ./ .\ .^ | & < <= == >= > != !<br />
**Tests for boolean operators: && ||<br />
**Tests for other operators: * / \ ' .'<br />
**Tests from bug reports.<br />
**Tests for indexed assignment. Need to consider the following:<br />
***fortran-style indexing<br />
***zero-one indexing<br />
***assignment of empty matrix as well as values resizing<br />
**Tests for all internal functions.<br />
<br />
* Implement a coverage tool for collecting coverage data and generating code coverage reports on m-file functions and scripts. This would be very useful for Octave development as well as for users who want a code coverage report for their own functions and scripts.<br />
<br />
We are far from even having one test for every function, so focus should be on getting the breadth of coverage first before trying to get the depth of 100% statement coverage. As of Dec 2015, 202 of 1020 m-files have no tests. Some of these will be plotting functions which have demos instead, but that leaves enough functions to be an interesting project. As of Dec 2015, there are 485 instances of C++ functions which need tests.<br />
<br />
After Octave is compiled, running the {{Codeline|make check}} build target will run the full test suite and generate a file called test/fntests.log in the build directory with a summary of the results. At the end of the file is a list of all functions for which no tests were found. An extract is posted in the [[files missing tests]] page. If you are not building Octave yourself, the test suite can be run on an installed binary copy by executing the {{Codeline|__run_test_suite__}} command at the Octave prompt. The fntests.log file will be written in the current directory in this case.<br />
<br />
There also need to be tests for functions written in the C++ files. See [[Add_BIST_tests_for_octave_functions_written_in_C%2B%2B]] for instructions and a list of instances.<br />
<br />
See also [[Continuous Build#Coverage Report]].<br />
<br />
=Programming=<br />
<br />
*Better error messages for missing operators?<br />
<br />
*Eliminate duplicate enums in pt-exp.cc, pt-const.cc, and ov.cc.<br />
<br />
*Handle octave_print_internal() stuff at the liboctave level. Then the octave_value classes could just call on the print() methods for the underlying classes.<br />
<br />
*As much as possible, eliminate explicit checks for the types of octave_value objects so that user-defined types will automatically do the right thing in more cases.<br />
<br />
*Only include config.h in files that actually need it, instead of including it in every .cc file. Unfortunately, this might not be so easy to figure out.<br />
<br />
*GNU coding standards:<br />
**Add a `Makefile' target to the Makefiles.<br />
**Comments on #else and #endif preprocessor commands.<br />
**Change error message format to match standards everywhere.<br />
<br />
*Eliminate more global variables.<br />
<br />
*Move procstream to liboctave.<br />
<br />
*Use references and classes in more places.<br />
<br />
*Share more code among the various _options functions.<br />
<br />
*Use non-empty identifiers in all warnings and errors issued by Octave, see [[Easy projects#Miscellaneous]].<br />
<br />
*Reduce the amount of datatypes in liboctave.<br />
<br />
=Miscellaneous=<br />
<br />
*Implement some functions for interprocess communication: bind, accept, connect, gethostbyname, etc. (This functionality is already available in the octave sockets package, what is the purpose of moving it to core octave?)<br />
<br />
*The ability to transparently handle very large files: Juhana K Kouhia <kouhia@nic.funet.fi> wrote:<br />
*: If I have a one-dimensional signal data with the size 400 Mbytes, then what are my choices to operate with it:<br />
*:*I have to split the data<br />
*:*Octave has a virtual memory on its own and I don't have to worry about the splitting.<br />
*:If I split the data, then my easily programmed processing programs will become hard to program.<br />
*:If possible, I would like to have the virtual memory system in Octave i.e., the all big files, the user see as one big array or such. There could be several user selectable models to do the virtual memory depending on what kind of data the user have (1d, 2d) and in what order they are processed (stream or random access).<br />
<br />
*An interface to gdb. Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote:<br />
*:I was thinking about a tool, which could be very useful for me in my numerical simulation work. It is an interconnection between gdb and octave. We are often managing very large arrays of data in our fortran or c codes, which might be studied with the help of octave at the algorithm development stages. Assume you're coding, say, wave equation. And want to debug the code. It would be great to pick some array from the memory of the code you're developing, fft it and see the image as a log-log plot of the spectral density. I'm facing similar problems now. To avoid high c-development cost, I develop in matlab/octave, and then rewrite into c. It might be so much easier, if I could off-load a c array right from the debugger into octave, study it, and, perhaps, change some [many] values with a convenient matlab/octave syntax, similar to <code>a(:,51:250)=zeros(100,200)</code>, and then store it back into the memory of my c code.<br />
<br />
*Implement gdb extensions for Octave types. Octave has the <code>etc/gdbinit</code> file, which has some basic support for displaying the contents of Octave types. Add more extensions to make it easier to debug octave_values and other Octave types.<br />
<br />
*Add a definition to lgrind so that it supports Octave. (See http://www.tex.ac.uk/tex-archive/support/lgrind/ for more information about lgrind.)<br />
<br />
*Spatial statistics, including covariogram estimation and kriging -- perhaps via an interface to [http://www.gstat.org/ gstat]?<br />
<br />
* the [http://octave.sourceforge.net/miscellaneous/function/units.html units] function from the miscellaneous package works by parsing the output of from a call to GNU units. This can be made much more robust by writing it in C++ and including its library "units.h"<br />
<br />
=Marketing and Community=<br />
<br />
* Make the Octave website/[[Project Infrastructure]] easier to maintain.<br />
<br />
* Make it easier for newcomers to contribute.<br />
<br />
* For marketing ideas, see the [https://openoffice.apache.org/orientation/intro-marketing.html Apache Open Office Introduction to Marketing]<br />
<br />
* Help design a user or a [https://www.openoffice.org/marketing/ooocon2006/presentations/wednesday_c10.pdf developer survey]<br />
<br />
* Help prepare and deliver presentations and [[Publications about Octave]] at colleges and universities.<br />
<br />
* Create a [[Forum for GNU Octave]].<br />
<br />
== Improve Windows binary packaging ==<br />
<br />
We are currently able to build and provide a [[Windows Installer|installer for Windows]]. The build process involves cross-compiling on a Linux system using a fork of the [http://mxe.cc/ MXE] project to build Octave and all of its dependencies. Any ideas for improving this process to make it easier or faster, or to improve the installer itself or the installation experience for Windows users would be appreciated.<br />
<br />
'''Skills Required''': Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. No m-scripting or C++ necessary, beyond understanding [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
== Improve macOS binary packaging ==<br />
<br />
We would like to be able to easily generate binary packages for macOS. Right now, it's difficult and tedious to do so. Most OS X users install Octave using one of the source-based package managers such as Homebrew or MacPorts. Any way to help us build a binary package would be appreciated. Required knowledge is understanding how building binaries in macOS works. Our current approach to building binaries for Windows is to cross-compile from a GNU system using [http://mxe.cc/ MXE], something similar may be possible for OS X ([http://lilypond.org/gub/ GUB]?).<br />
<br />
'''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 [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
=Performance=<br />
<br />
*A profiler for Octave would be a very useful tool. And now we have one! But it really needs a better interface.<br />
*Having {{Codeline|parfor}} functioning would speed code development and execution now that multicore architectures are widespread. See [http://octave.1599824.n4.nabble.com/Parfor-td4630575.html here] and [http://stackoverflow.com/questions/24970519/how-to-use-parallel-for-loop-in-octave-or-scilab here]. Existing code from the [[Parallel package | parallel]] and [http://octave.sourceforge.net/mpi/index.html mpi] packages could perhaps be adapted for this.<br />
<br />
=Packaging=<br />
<br />
* create a system that allows packages to deprecate functions as in core. Possibilities are:<br />
** get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated<br />
** PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release<br />
** the package developer can also use something like Make to create a ''normal'' package from something that actually had a more complex structure, inclusive deprecated directories<br />
* get pkg to resolve dependencies automatically by downloading and installing them too<br />
* allow to download and install multiple versions of the same package<br />
* make the package just a bit more verbose by default (specifics?)<br />
* make pkg a little more like apt-get (what specific features of apt-get is this referring to?)<br />
* make pkg support more than one src directory<br />
** subdirectories with makefiles and top level make command of: cd <subdir> && ${MAKE}... ok as a substitute?<br />
* make pkg able to supply extra configure and make flags, useful for distributions, including -j for make (pkg now passes --jobs=N automatically, CFLAGS and CXXFLAGS environment variables are already respected, what's missing?)<br />
<br />
=Preferences=<br />
<br />
Octave has several functions for managing user preferences. Many function use persistent variables instead of relying upon the preference features.<br />
* The function {{Codeline|edit ()}} contains a persistent structure used as its personal set of preferences. These can all be moved to the user preference group for the editor.<br />
** "EDITOR"<br />
** "HOME"<br />
** "AUTHOR"<br />
** "EMAIL"<br />
** "LICENSE"<br />
** "MODE"<br />
** "EDITINPLACE"<br />
* The {{Codeline|savepath ()}} function modifies the startup script (rcfile), {{Codeline|~/.octaverc}} and inserts commands to allow the next session to begin with the same path. Instead user preference can be created for startup items and a preference for the user specified path can be added. Perhaps two path preferences should be used. One for the elements that should precede the core path and those that should follow. A start up directory preference might also be added to allow the user to specify where Octave should begin the next session.<br />
** "PREPATH"<br />
** "POSTPATH"<br />
** "STARTUPDIR"<br />
* A preference group for plotting can also be added. A preference for the default terminal would be useful for those who want to override the default. Preferences for the default {{Codeline|graphicstoolkit}} can also be added.<br />
** GNUPLOTTERM<br />
** GRAPHICSTOOLKIT<br />
* A preference group for printing can include preferences for the default printer, the ghostscript command, and possibly other parameters like orientation, and resolution.<br />
** PRINTER<br />
** GHOSTSCRIPTCOMMAND<br />
** ORIENTATION<br />
** RESOLUTION<br />
* Searching the m-files for use of {{Codeline|persistent}} should turn up other opportunities to use preferences.<br />
<br />
=Bugs=<br />
<br />
There are always bugs to fix. The [https://savannah.gnu.org/bugs/?group=octave bug tracker] is a good place to find tasks needing a hand. See also [[Short projects#Bugs]].<br />
<br />
= Matlab compatibility =<br />
<br />
== Missing functions ==<br />
<br />
There are certain functions present in MATLAB known to be missing in Octave.<br />
<br />
One list is provided on the source for function __unimplemented.m__, subfunction missing_functions; it can be edited in the Octave GUI or browsed at [http://hg.savannah.gnu.org/hgweb/octave/file/default/scripts/help/__unimplemented__.m#l547].<br />
<br />
Lists are also kept for [[:Category:Missing functions|several packages]].<br />
<br />
It is also possible to look at existing [[Wikipedia:Free and open-source software|FOSS]] implementations, from FreeMat and Scilab (for more closely compatible languages) to R or Scipy or Julia (for less compatible versions). Obviously, it is NOT OK to look at the Matlab implementation since this is not [[Wikipedia:Free software|free software]]!<br />
<br />
== Functions under different name ==<br />
<br />
Many Octave Forge functions perform the same as functions from matlab packages. However, they often exist under a different name or have incompatible API's. Often fixing this is a matter of changing their names, swap the order of their input arguments. At least, a list of this functions would be helpful.<br />
<br />
<br />
<br />
[[Category:Development]]<br />
[[Category:Project Ideas]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Projects&diff=12636Projects2020-02-04T10:02:57Z<p>Cdf: /* Matlab-compatible ODE solvers in core-Octave */</p>
<hr />
<div>The list below summarizes features or bug fixes we would like to see in Octave. if you start working steadily on a project, please let octave-maintainers@octave.org know. We might have information that could help you. You should also read the [[Contribution guidelines |Contributing Guidelines]].<br />
<br />
This list is not exclusive -- there are many other things that might be good projects, but it might instead be something we already have. Also, some of the following items may not actually be considered good ideas now. So please check with octave-maintainers@octave.org before you start working on some large project.<br />
<br />
Summer of Code students, please also see [[SoC Project Ideas]].<br />
<br />
If you're looking for small project, something more suited to start getting involved with Octave development or to fill a boring evening, see [[short projects]]<br />
<br />
=Numerical=<br />
<br />
* Use C++11 <random> libraries for random number generation. Write link between Octave functions (rand, randi, randn, rande) and C++ API. Implement RandStream objects as Matlab does.<br />
<br />
*Improve logm, and sqrtm (see this thread: http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html)<br />
<br />
*Use pairwise addition in sum() to mitigate against numerical errors without substantial performance penalty (https://en.wikipedia.org/wiki/Pairwise_summation).<br />
<br />
*Review implementing algorithm in this 2009 paper (https://epubs.siam.org/doi/pdf/10.1137/080738490) for xsum (sum with extra accuracy). The existing implementation uses a 2005 paper.<br />
<br />
*Improve complex mapper functions. See W. Kahan, ``Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit (in The State of the Art in Numerical Analysis, eds. Iserles and Powell, Clarendon Press, Oxford, 1987) for explicit trigonometric formulae. See {{patch|8172}} for a previous attempt.<br />
<br />
*Make functions like gamma() return the right IEEE Inf or NaN values for extreme args or other undefined cases.<br />
<br />
*Improve sqp.<br />
<br />
*Fix CollocWt? to handle Laguerre polynomials. Make it easy to extend it to other polynomial types.<br />
<br />
*Add optional arguments to colloc so that it's not restricted to Legendre polynomials.<br />
<br />
*Move rand, eye, xpow, xdiv, etc., functions to the matrix classes.<br />
<br />
*Improve design of ODE, DAE, classes.<br />
<br />
*Make QR more memory efficient for large matrices when not all the columns of Q are required (apparently this is not handled by the lapack code yet).<br />
<br />
*Evaluate harmonics and cross-correlations of unevenly sampled and nonstationary time series, as in http://www.jstatsoft.org/v11/i02 (which has C code with interface to R). (This is now partly implemented in the [http://octave.sourceforge.net/lssa/index.html lssa] package.)<br />
<br />
<!-- == General purpose Finite Element library ==<br />
<br />
Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes,<br />
namely the [[bim package]] which relies on the [http://octave.sf.net/msh msh package] (which is in turn based on [http://geuz.org/gmsh/ gmsh]) for creating and managing 2D triangular and 3D tetrahedral meshes and on the [http://octave.sf.net/fpl fpl package] for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with [http://www.paraview.org Paraview] or [https://wci.llnl.gov/codes/visit/ 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.<br />
The [http://geopdes.sf.net GeoPDEs] project, on the other hand, offers a complete suite of functions for discretizing a wide range of<br />
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 [http://geopdes.sf.net 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 [http://fenicsproject.org/documentation/ FEniCS] based on the existing C++ or Python interfaces. This second approach has been developed during the GSOC 2013 and the Octave-Forge package [http://octave.sf.net/fem-fenics fem-fenics] is now available. However, fem-fenics could be extended in many different ways:<br />
* implement the bindings for the UFL language inside Octave<br />
* add new functions already available with Fenics but not yet in Octave<br />
* create new functions specifically suited for Octave<br />
* improve the efficiency of the code<br />
The main goal for the fem-fenics package is ultimately to be merged with the FEnics project itself, so that it can remain in-sync with the main library development. --><br />
<br />
== Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D ==<br />
<br />
The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function <tt>pdepe</tt>. A good starting point is the [http://en.wikipedia.org/wiki/Method_of_lines method of lines] for which you can find more details [http://en.wikibooks.org/wiki/Partial_Differential_Equations/Method_of_Lines here] and [http://www.scholarpedia.org/article/Method_of_lines here], whereas an example implementation can be found [http://www.scholarpedia.org/article/Method_of_Lines/Example_Implementation here]. In addition, [http://www.pdecomp.net/ this page] provides some useful material.<br />
<br />
== Implement solver for 1D nonlinear boundary value problems ==<br />
<br />
The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package<br />
by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver.<br />
Details on the methods to be implemented can be found in [http://dx.doi.org/10.1145/502800.502801 this paper] on bvp4c and [http://www.jnaiam.net/new/uploads/files/014dde86eef73328e7ab674d1a32aa9c.pdf this paper] on bvp5c. Further details are available in [http://books.google.it/books/about/Nonlinear_two_point_boundary_value_probl.html?id=s_pQAAAAMAAJ&redir_esc=y this book].<br />
<br />
<!-- == Geometric integrators for Hamiltonian Systems ==<br />
<br />
[http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration Geometric (AKA Symplectic) integrators] are useful for <br />
multi-dimensional classical mechanics problems and for molecular dynamics simulations.<br />
The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently<br />
specifically suited for second order problems in general and Hamiltonian systems in particular.<br />
Therefore a new package for geometric integrators would be a useful contribution.<br />
This could be created as new package or added as a set of new functions for odepkg.<br />
The function interface should be consistent throughout the package and should be modeled to follow <br />
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.<br />
An initial list of methods to be implemented includes (but is not limited to)<br />
* Symplectic Euler methods, see [http://en.wikipedia.org/wiki/Semi-implicit_Euler_method here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Störmer-Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Velocity Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Symplectic partitioned Runge-Kutta methods, see [http://reference.wolfram.com/mathematica/tutorial/NDSolveSPRK.html here] or [http://dx.doi.org/10.1137/0733019 here]<br />
* Spectral Variational Integrator methods, see [http://www3.nd.edu/~izaguirr/papers/acta_numerica.pdf here] or [http://www.math.ucsd.edu/~mleok/pdf/HaLe2012_SVI.pdf here]<br />
<br />
For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker.<br />
Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.<br />
* SHAKE, see [http://en.wikipedia.org/wiki/Constraint_algorithm here] or [http://dx.doi.org/10.1016/0021-9991(77)90098-5 here]<br />
* RATTLE, see [http://dx.doi.org/10.1016/0021-9991(83)90014-1 here] or [http://dx.doi.org/10.1002/jcc.540161003 here]<br />
--><br />
<br />
== Matlab-compatible ODE solvers in core-Octave ==<br />
<br />
* <strike> 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. </strike><br />
* <strike> Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core. </strike><br />
* <strike> Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [https://savannah.gnu.org/patch/?8102 here] 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. </strike><br />
* Improve handling of sparse Jacobians in IDE/DAE solvers<br />
** Currently, in the IDA wrapper function __ode15__ an over conservative guess for the amount of memory to be allocated when assembling a sparse jacobian is used, essentially allocating enough space for a full jacobian then freeing the excess memory, an initial patch for fixing this has been posted on the tracker, for integrating this into Octave it must be generalized to support prior versions of SUNDIALS<br />
** Currently Jacobians passed by the user in Octave's sparse matrix format are copied into SUNDIALS own sparse matrix format. Newer versions of SUNDIALS (5.x or higher) support letting the user take care of the linear algebra data structures and methods thus removing the need for the copy. Taking advantage of this feature would improve the solver performance both in terms of memory footprint and speed.<br />
** References<br />
***[https://savannah.gnu.org/bugs/?func=detailitem&item_id=55905 tracker post about memory allocation] <br />
***[https://computing.llnl.gov/projects/sundials/release-history SUNDIALS release history]<br />
* Implement Matlab compatible versions of "deval".<br />
<br />
== High Precision Arithmetic Computation ==<br />
<br />
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-conditioned. 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<br />
<br />
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.<br />
<br />
=GUI/IDE=<br />
<br />
*Søren Hauberg has suggested that we need C++ code that can:<br />
**Determine if a line of code could be fully parsed, i.e. it would return true for "plot (x, y);", but false for "while (true)".<br />
**Evaluate a line of code and return the output as a string (it would be best if it could provide three strings: output, warnings and errors).<br />
**Query defined variables, i.e. get a list of currently defined variables. Bonus points if it could tell you if anything had changed since the last time you checked the variables (could also be done with signals).<br />
* Create a better (G)UI for the {{manual|profile|profiler}}. This may be done with Qt, but not necessarily.<br />
<br />
== GUI Variable Editor and Property Inspector ==<br />
<br />
Octave has a preliminary implementation of a Variable Editor: a spreadsheet-like tool for quickly editing and visualizing variables. The initial phase of the project will be learning how the implementation was done.<br />
<br />
With the knowledge gained, the second part of the project will be to implement a Property Inspector. This is a spreadsheet like interface to the many, many graphics properties that exist and are different on a per-object basis. The goal would be not only the concise-display of the existing properties, but a reasonable user interface to change them. As examples, Boolean properties should be able to be toggled with a double-click; Radio properties should have a drop-down list of only the supported options; Other properties that can be modified should have the constraints built-in (for example, Linewidth must be a scalar, while Position must be a 1x4 vector). It would also be important to have easy access to the documentation of a property.<br />
<br />
For reference, Matlab has a similar Property Inspector (https://www.mathworks.com/help/matlab/ref/inspect.html).<br />
<br />
== Sisotool. Create a graphical design tool for tuning closed loop control system ([[Control package]])==<br />
<br />
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.<br />
Recently, some implementation was done during [[Summer_of_Code#GSoC_2018|GSoC 2018]], see https://eriveltongualter.github.io/GSoC2018/final.html for details.<br />
<br />
=Sparse Matrices=<br />
<br />
The paper by [http://arxiv.org/abs/cs.MS/0604006 Bateman & Adler] is good reading for understanding the sparse matrix implementation.<br />
<br />
*Improve Matlab compatibility for {{manual|sprandsym}}.<br />
<br />
*Sparse logical indexing in idx_vector class so that something like <code>a = sprandn (1e6, 1e6, 1e-6); a(a<1) = 0;</code> won't cause a memory overflow.<br />
<br />
*Other missing Functions<br />
**lsqr<br />
**minres<br />
**symmlq<br />
<br />
== SPQR Interface ==<br />
<br />
Octave implements QR factorization for sparse matrices, but it does so with an older "CXSPARSE" library. This has caused fundamental issues, including segfaults as recorded here (bugs {{bug|51950}} and {{bug|57033}}). The goal of this project is to program an interface to the API for the SQPR library (http://faculty.cse.tamu.edu/davis/suitesparse.html). This is the same library that Matlab uses for this purpose.<br />
<br />
*Improve QR factorization functions, using idea based on CSPARSE cs_dmsol.m<br />
<br />
*Improve QR factorization by replacing CXSPARSE code with SPQR code, and make the linear solve return 2-norm solutions for ill-conditioned matrices based on this new code<br />
<br />
=Strings=<br />
<br />
*Consider making octave_print_internal() print some sort of text representation for unprintable characters instead of sending them directly to the terminal. (But don't do this for fprintf!)<br />
<br />
*Consider changing the default value of `string_fill_char' from SPC to NUL.<br />
<br />
=Other Data Types=<br />
<br />
*Template functions for mixed-type ops.<br />
<br />
*Convert other functions for use with the floating point type including quad, dasrt, daspk, etc.<br />
<br />
=Input/Output=<br />
<br />
*Make fread and fwrite work for complex data. Iostreams based versions of these functions would also be nice, and if you are working on them, it would be good to support other size specifications (integer*2, etc.).<br />
<br />
*Move some pr-output stuff to liboctave.<br />
<br />
*Make the cutoff point for changing to packed storage a user-preference variable with default value 8192.<br />
<br />
*Complain if there is not enough disk space available (I think there is simply not enough error checking in the code that handles writing data).<br />
<br />
*Make it possible to tie arbitrary input and output streams together, similar to the way iostreams can be tied together.<br />
<br />
*Expand {{codeline|imwrite}} options. This shouldn't be too hard to implement, since it's wrapped around GraphicsMagick.<br />
<br />
*Extend Octave functions to work on stored arrays that are too big to fit in RAM, similar to available R [http://www.bigmemory.org/ packages.]<br />
<br />
* write {{codeline|xmlread}} and {{codeline|xmlwrite}}. This could be done using [http://xerces.apache.org/xerces-c/ Xerces C++ interface] which apparently is what [http://octave.1599824.n4.nabble.com/xml-in-octave-td4663034.html Matlab uses].<br />
<br />
* Implement hdf5 for .mat files (see [http://octave.1599824.n4.nabble.com/Reading-Matlab-td4650158.html this thread]).<br />
<br />
=Interpreter=<br />
<br />
The interpreter is written in C++, undocumented. There are many possible projects associated with it.<br />
<br />
'''Required skills''': ''Very good'' C and C++ knowledge, possibly also understanding of [http://en.wikipedia.org/wiki/Gnu_bison GNU bison] and [http://en.wikipedia.org/wiki/Flex_lexical_analyser 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.<br />
<br />
*Allow customization of the debug prompt.<br />
<br />
*Fix the parser so that<br />
<br />
if (expr) 'this is a string' end<br />
<br />
is parsed as IF expr STRING END. ''(see [https://lists.gnu.org/archive/html/octave-maintainers/2014-03/msg00087.html this] post on the mailing list)''<br />
<br />
*Clean up functions in input.cc that handle user input (there currently seems to be some unnecessary duplication of code and it seems overly complex).<br />
<br />
*Consider allowing an arbitrary property list to be attached to any variable. This could be a more general way to handle the help string that can currently be added with `document'.<br />
<br />
*Allow more command line options to be accessible as built-in variables (--echo-commands, etc.).<br />
<br />
*Make the interpreter run faster.<br />
<br />
*Allow arbitrary lower bounds for array indexing.<br />
<br />
*Improve performance of recursive function calls.<br />
<br />
*Improve the way ignore_function_time_stamp works to allow selecting by individual directories or functions.<br />
<br />
*Add a command-line option to tell Octave to just do syntax checking and not execute statements.<br />
<br />
*Clean up symtab and variable stuff.<br />
<br />
*Input stream class for parser files -- must manage buffers for flex and context for global variable settings.<br />
<br />
*make parser do more semantic checking, continue after errors when compiling functions, etc.<br />
<br />
*Make LEXICAL_ERROR have a value that is the error message for parse_error() to print?<br />
<br />
*Add a run-time alias mechanism that would allow things like alias fun function_with_a_very_long_name so that `function_with_a_very_long_name' could be invoked as `fun'.<br />
<br />
*Allow local changes to variables to be written more compactly than is currently possible with unwind_protect. For example, <br />
<br />
function f ()<br />
local prefer_column_vectors = something;<br />
...<br />
endfunction<br />
<br />
<br />
would be equivalent to<br />
<br />
function f ()<br />
save_prefer_column_vectors = prefer_column_vectors;<br />
unwind_protect<br />
prefer_column_vectors = something;<br />
...<br />
unwind_protect_cleanup<br />
prefer_column_vectors = save_prefer_column_vectors;<br />
end_unwind_protect<br />
endfunction<br />
<br />
<br />
*Fix all function files to check for bogus inputs (wrong number or types of input arguments, wrong number of output arguments).<br />
<br />
*Handle options for built-in functions more consistently.<br />
<br />
*Too much time is spent allocating and freeing memory. What can be done to improve performance?<br />
<br />
Use move constructors rather than copy constructors for things like dim_vectors which are repeatedly created just to initialize Array or Matrix objects.<br />
<br />
*Error output from Fortran code is ugly. Something should be done to make it look better.<br />
<br />
*It would be nice if output from the Fortran routines could be passed through the pager.<br />
<br />
*Attempt to recognize common subexpressions in the parser.<br />
<br />
*Consider making it possible to specify an empty matrix with a syntax like [](e1, e2). Of course at least one of the expressions must be zero...<br />
<br />
*Is Matrix::fortran_vec() really necessary?<br />
<br />
*Rewrite whos and the symbol_record_info class. Write a built-in function that gives all the basic information, then write who and whos as M-files.<br />
<br />
*On systems that support matherr(), make it possible for users to enable the printing of warning messages.<br />
<br />
*Make it possible to mark variables and functions as read-only.<br />
<br />
*Make it possible to write a function that gets a reference to a matrix in memory and change one or more elements without generating a second copy of the data.<br />
<br />
*Use nanosleep instead of usleep if it is available? Apparently nanosleep is to be preferred over usleep on Solaris systems.<br />
<br />
*<strike>Per the following discussion, allow bsxfun style singleton dimension expansion as the default behavior for the builtin element-wise operators: http://octave.1599824.n4.nabble.com/Vector-approach-to-row-margin-frequencies-tp1636361p1636367.html</strike> This is done. <strike>Now [[User:JordiGH|I]] just have to document it.</strike> This is done too!<br />
<br />
== Improve JIT compiling ==<br />
<br />
Octave's interpreter is ''very'' slow on some loops. Recently, thanks to Max Brister's work, an initial implementation of a just-in-time compiler (JITC) in [http://llvm.org 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. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation. See also [[JIT]].<br />
<br />
== Improve memory management ==<br />
<br />
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.<br />
<br />
== Implement classdef classes ==<br />
<br />
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 classdef classes in version 4.0, refer to the [[Classdef|classdef status page]] for what is not yet implemented. There is irregular work here, and classdef is [http://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html a very] [http://www.mathworks.com/help/matlab/events-sending-and-responding-to-messages.html complicated] [http://www.mathworks.com/help/matlab/enumeration-classes.html 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.<br />
<br />
Although there's already a substantial classdef support in current octave code base, there are still many areas that are unimplemented or need improvements. The main ones that come to my mind are:<br />
* support for events<br />
* support for enums<br />
* support for "import" (this requires good understanding of octave internals, especially the symbol table)<br />
* improving multiple inheritance and method resolution<br />
* honoring and computing "Sealed" attribute<br />
* support for function handle to methods<br />
<br />
== Improve MPI package ==<br />
<br />
Octave Forge's [http://octave.sourceforge.net/mpi/index.html MPI package] <br />
is a wrapper for basic MPI functions for parallel computing. It is implemented <br />
by wrapping MPI function calls in simple DLD functions that map Octave's Datataypes to <br />
MPI Derived Datatypes. <br />
The proposed project deals with improving and extending the Octave MPI package, for example:<br />
* Octave MPI applications can currently be only run in batch mode, add the ability to launch parallel jobs and collect their output in an interactive Octave session.<br />
* Implement functions for non-blocking communication (MPI_Isend, MPI_Irecv)<br />
* Implement one-to-many (Broadcast, Scatter), many-to-one (Reduce, Gather), and many-to-many (All Reduce, Allgather) communication routines<br />
<br />
=Graphics=<br />
<br />
*Correctly handle case where DISPLAY is unset. Provide --no-window-system or --nodisplay (?) option. Provide --display=DISPLAY option? How will this work with gnuplot (i.e., how do we know whether gnuplot requires an X display to display graphics)?<br />
<br />
* Implement transparency and lighting in OpenGL backend(s). A basic implementation was available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of octave.<br />
<br />
* Implement a Cairo-based renderer for 2D-only graphics, with support for PS/PDF/SVG output (for printing).<br />
<br />
* On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.<br />
<br />
* Add map-creating capabilities similar to the Matlab [http://www.mathworks.com/help/map/functionlist.html Mapping toolbox] for inclusion in the Octave Forge [https://sourceforge.net/p/octave/mapping mapping package].<br />
<br />
* Add data cursor to trace data values in figure.<br />
<br />
== Lighting ==<br />
<br />
Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.<br />
<br />
== Object selection in OpenGL renderer ==<br />
<br />
This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [http://glprogramming.com/red/chapter13.html]<br />
<br />
== Non-OpenGL renderer ==<br />
<br />
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:<br />
* [http://qt.nokia.com Qt]: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [https://github.com/goffioul/QtHandles]<br />
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.<br />
<br />
== TeX/LaTeX markup ==<br />
<br />
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.<br />
<br />
* 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,<br />
<br />
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre><br />
<br />
:Would be rendered as,<br />
<br />
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup><br />
<br />
:This is analogous to how special characters may be included in a wiki using html.<br />
<br />
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre><br />
<br />
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].<br />
<br />
* 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.<br />
<br />
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html 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 [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.<br />
<br />
=History=<br />
<br />
*Add an option to allow saving input from script files in the history list.<br />
<br />
*The history command should accept two numeric arguments to indicate a range of history entries to display, save or read.<br />
<br />
*Avoid writing the history file if the history list has not changed.<br />
<br />
*Avoid permission errors if the history file cannot be opened for writing.<br />
<br />
*Fix history problems — core dump if multiple processes are writing to the same history file?<br />
<br />
=Configuration and Installation=<br />
<br />
*Makefile changes:<br />
**eliminate for loops<br />
**define shell commands or eliminate them<br />
**consolidate targets<br />
<br />
*Create a docs-only distribution?<br />
<br />
*<strike> Convert build system to a non-recursive Automake setup. See how Makefile.am files currently include module.mk files in subdirectories, extend this concept to the entire project so there is only one top-level Makefile.am. </strike> Done, except for special dir libgnu which is the only SUBDIRS listed in configure.ac.<br />
<br />
=Documentation and On-Line Help=<br />
<br />
*Improve the Texinfo Documentation for the interpreter. It would be useful to have lots more examples, to not have so many forward references, and to not have very many simple lists of functions.<br />
<br />
*[[Doxygen]] documentation for the C++ classes.<br />
<br />
*Make index entries more consistent to improve behavior of <code>help -i</code>.<br />
<br />
*Make <code>help -i</code> try to find a whole word match first.<br />
<br />
*Add more demo files.<br />
<br />
*Flesh out this wiki<br />
<br />
=Tests=<br />
*Improved set of tests: [http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=370633]<br />
**Tests for various functions. Would be nice to have a test file corresponding to every function (see below)<br />
**Tests for element by element operators: + - .* ./ .\ .^ | & < <= == >= > != !<br />
**Tests for boolean operators: && ||<br />
**Tests for other operators: * / \ ' .'<br />
**Tests from bug reports.<br />
**Tests for indexed assignment. Need to consider the following:<br />
***fortran-style indexing<br />
***zero-one indexing<br />
***assignment of empty matrix as well as values resizing<br />
**Tests for all internal functions.<br />
<br />
* Implement a coverage tool for collecting coverage data and generating code coverage reports on m-file functions and scripts. This would be very useful for Octave development as well as for users who want a code coverage report for their own functions and scripts.<br />
<br />
We are far from even having one test for every function, so focus should be on getting the breadth of coverage first before trying to get the depth of 100% statement coverage. As of Dec 2015, 202 of 1020 m-files have no tests. Some of these will be plotting functions which have demos instead, but that leaves enough functions to be an interesting project. As of Dec 2015, there are 485 instances of C++ functions which need tests.<br />
<br />
After Octave is compiled, running the {{Codeline|make check}} build target will run the full test suite and generate a file called test/fntests.log in the build directory with a summary of the results. At the end of the file is a list of all functions for which no tests were found. An extract is posted in the [[files missing tests]] page. If you are not building Octave yourself, the test suite can be run on an installed binary copy by executing the {{Codeline|__run_test_suite__}} command at the Octave prompt. The fntests.log file will be written in the current directory in this case.<br />
<br />
There also need to be tests for functions written in the C++ files. See [[Add_BIST_tests_for_octave_functions_written_in_C%2B%2B]] for instructions and a list of instances.<br />
<br />
See also [[Continuous Build#Coverage Report]].<br />
<br />
=Programming=<br />
<br />
*Better error messages for missing operators?<br />
<br />
*Eliminate duplicate enums in pt-exp.cc, pt-const.cc, and ov.cc.<br />
<br />
*Handle octave_print_internal() stuff at the liboctave level. Then the octave_value classes could just call on the print() methods for the underlying classes.<br />
<br />
*As much as possible, eliminate explicit checks for the types of octave_value objects so that user-defined types will automatically do the right thing in more cases.<br />
<br />
*Only include config.h in files that actually need it, instead of including it in every .cc file. Unfortunately, this might not be so easy to figure out.<br />
<br />
*GNU coding standards:<br />
**Add a `Makefile' target to the Makefiles.<br />
**Comments on #else and #endif preprocessor commands.<br />
**Change error message format to match standards everywhere.<br />
<br />
*Eliminate more global variables.<br />
<br />
*Move procstream to liboctave.<br />
<br />
*Use references and classes in more places.<br />
<br />
*Share more code among the various _options functions.<br />
<br />
*Use non-empty identifiers in all warnings and errors issued by Octave, see [[Easy projects#Miscellaneous]].<br />
<br />
*Reduce the amount of datatypes in liboctave.<br />
<br />
=Miscellaneous=<br />
<br />
*Implement some functions for interprocess communication: bind, accept, connect, gethostbyname, etc. (This functionality is already available in the octave sockets package, what is the purpose of moving it to core octave?)<br />
<br />
*The ability to transparently handle very large files: Juhana K Kouhia <kouhia@nic.funet.fi> wrote:<br />
*: If I have a one-dimensional signal data with the size 400 Mbytes, then what are my choices to operate with it:<br />
*:*I have to split the data<br />
*:*Octave has a virtual memory on its own and I don't have to worry about the splitting.<br />
*:If I split the data, then my easily programmed processing programs will become hard to program.<br />
*:If possible, I would like to have the virtual memory system in Octave i.e., the all big files, the user see as one big array or such. There could be several user selectable models to do the virtual memory depending on what kind of data the user have (1d, 2d) and in what order they are processed (stream or random access).<br />
<br />
*An interface to gdb. Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote:<br />
*:I was thinking about a tool, which could be very useful for me in my numerical simulation work. It is an interconnection between gdb and octave. We are often managing very large arrays of data in our fortran or c codes, which might be studied with the help of octave at the algorithm development stages. Assume you're coding, say, wave equation. And want to debug the code. It would be great to pick some array from the memory of the code you're developing, fft it and see the image as a log-log plot of the spectral density. I'm facing similar problems now. To avoid high c-development cost, I develop in matlab/octave, and then rewrite into c. It might be so much easier, if I could off-load a c array right from the debugger into octave, study it, and, perhaps, change some [many] values with a convenient matlab/octave syntax, similar to <code>a(:,51:250)=zeros(100,200)</code>, and then store it back into the memory of my c code.<br />
<br />
*Implement gdb extensions for Octave types. Octave has the <code>etc/gdbinit</code> file, which has some basic support for displaying the contents of Octave types. Add more extensions to make it easier to debug octave_values and other Octave types.<br />
<br />
*Add a definition to lgrind so that it supports Octave. (See http://www.tex.ac.uk/tex-archive/support/lgrind/ for more information about lgrind.)<br />
<br />
*Spatial statistics, including covariogram estimation and kriging -- perhaps via an interface to [http://www.gstat.org/ gstat]?<br />
<br />
* the [http://octave.sourceforge.net/miscellaneous/function/units.html units] function from the miscellaneous package works by parsing the output of from a call to GNU units. This can be made much more robust by writing it in C++ and including its library "units.h"<br />
<br />
=Marketing and Community=<br />
<br />
* Make the Octave website/[[Project Infrastructure]] easier to maintain.<br />
<br />
* Make it easier for newcomers to contribute.<br />
<br />
* For marketing ideas, see the [https://openoffice.apache.org/orientation/intro-marketing.html Apache Open Office Introduction to Marketing]<br />
<br />
* Help design a user or a [https://www.openoffice.org/marketing/ooocon2006/presentations/wednesday_c10.pdf developer survey]<br />
<br />
* Help prepare and deliver presentations and [[Publications about Octave]] at colleges and universities.<br />
<br />
* Create a [[Forum for GNU Octave]].<br />
<br />
== Improve Windows binary packaging ==<br />
<br />
We are currently able to build and provide a [[Windows Installer|installer for Windows]]. The build process involves cross-compiling on a Linux system using a fork of the [http://mxe.cc/ MXE] project to build Octave and all of its dependencies. Any ideas for improving this process to make it easier or faster, or to improve the installer itself or the installation experience for Windows users would be appreciated.<br />
<br />
'''Skills Required''': Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. No m-scripting or C++ necessary, beyond understanding [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
== Improve macOS binary packaging ==<br />
<br />
We would like to be able to easily generate binary packages for macOS. Right now, it's difficult and tedious to do so. Most OS X users install Octave using one of the source-based package managers such as Homebrew or MacPorts. Any way to help us build a binary package would be appreciated. Required knowledge is understanding how building binaries in macOS works. Our current approach to building binaries for Windows is to cross-compile from a GNU system using [http://mxe.cc/ MXE], something similar may be possible for OS X ([http://lilypond.org/gub/ GUB]?).<br />
<br />
'''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 [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
=Performance=<br />
<br />
*A profiler for Octave would be a very useful tool. And now we have one! But it really needs a better interface.<br />
*Having {{Codeline|parfor}} functioning would speed code development and execution now that multicore architectures are widespread. See [http://octave.1599824.n4.nabble.com/Parfor-td4630575.html here] and [http://stackoverflow.com/questions/24970519/how-to-use-parallel-for-loop-in-octave-or-scilab here]. Existing code from the [[Parallel package | parallel]] and [http://octave.sourceforge.net/mpi/index.html mpi] packages could perhaps be adapted for this.<br />
<br />
=Packaging=<br />
<br />
* create a system that allows packages to deprecate functions as in core. Possibilities are:<br />
** get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated<br />
** PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release<br />
** the package developer can also use something like Make to create a ''normal'' package from something that actually had a more complex structure, inclusive deprecated directories<br />
* get pkg to resolve dependencies automatically by downloading and installing them too<br />
* allow to download and install multiple versions of the same package<br />
* make the package just a bit more verbose by default (specifics?)<br />
* make pkg a little more like apt-get (what specific features of apt-get is this referring to?)<br />
* make pkg support more than one src directory<br />
** subdirectories with makefiles and top level make command of: cd <subdir> && ${MAKE}... ok as a substitute?<br />
* make pkg able to supply extra configure and make flags, useful for distributions, including -j for make (pkg now passes --jobs=N automatically, CFLAGS and CXXFLAGS environment variables are already respected, what's missing?)<br />
<br />
=Preferences=<br />
<br />
Octave has several functions for managing user preferences. Many function use persistent variables instead of relying upon the preference features.<br />
* The function {{Codeline|edit ()}} contains a persistent structure used as its personal set of preferences. These can all be moved to the user preference group for the editor.<br />
** "EDITOR"<br />
** "HOME"<br />
** "AUTHOR"<br />
** "EMAIL"<br />
** "LICENSE"<br />
** "MODE"<br />
** "EDITINPLACE"<br />
* The {{Codeline|savepath ()}} function modifies the startup script (rcfile), {{Codeline|~/.octaverc}} and inserts commands to allow the next session to begin with the same path. Instead user preference can be created for startup items and a preference for the user specified path can be added. Perhaps two path preferences should be used. One for the elements that should precede the core path and those that should follow. A start up directory preference might also be added to allow the user to specify where Octave should begin the next session.<br />
** "PREPATH"<br />
** "POSTPATH"<br />
** "STARTUPDIR"<br />
* A preference group for plotting can also be added. A preference for the default terminal would be useful for those who want to override the default. Preferences for the default {{Codeline|graphicstoolkit}} can also be added.<br />
** GNUPLOTTERM<br />
** GRAPHICSTOOLKIT<br />
* A preference group for printing can include preferences for the default printer, the ghostscript command, and possibly other parameters like orientation, and resolution.<br />
** PRINTER<br />
** GHOSTSCRIPTCOMMAND<br />
** ORIENTATION<br />
** RESOLUTION<br />
* Searching the m-files for use of {{Codeline|persistent}} should turn up other opportunities to use preferences.<br />
<br />
=Bugs=<br />
<br />
There are always bugs to fix. The [https://savannah.gnu.org/bugs/?group=octave bug tracker] is a good place to find tasks needing a hand. See also [[Short projects#Bugs]].<br />
<br />
= Matlab compatibility =<br />
<br />
== Missing functions ==<br />
<br />
There are certain functions present in MATLAB known to be missing in Octave.<br />
<br />
One list is provided on the source for function __unimplemented.m__, subfunction missing_functions; it can be edited in the Octave GUI or browsed at [http://hg.savannah.gnu.org/hgweb/octave/file/default/scripts/help/__unimplemented__.m#l547].<br />
<br />
Lists are also kept for [[:Category:Missing functions|several packages]].<br />
<br />
It is also possible to look at existing [[Wikipedia:Free and open-source software|FOSS]] implementations, from FreeMat and Scilab (for more closely compatible languages) to R or Scipy or Julia (for less compatible versions). Obviously, it is NOT OK to look at the Matlab implementation since this is not [[Wikipedia:Free software|free software]]!<br />
<br />
== Functions under different name ==<br />
<br />
Many Octave Forge functions perform the same as functions from matlab packages. However, they often exist under a different name or have incompatible API's. Often fixing this is a matter of changing their names, swap the order of their input arguments. At least, a list of this functions would be helpful.<br />
<br />
<br />
<br />
[[Category:Development]]<br />
[[Category:Project Ideas]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Projects&diff=12635Projects2020-02-04T10:01:57Z<p>Cdf: /* Matlab-compatible ODE solvers in core-Octave */</p>
<hr />
<div>The list below summarizes features or bug fixes we would like to see in Octave. if you start working steadily on a project, please let octave-maintainers@octave.org know. We might have information that could help you. You should also read the [[Contribution guidelines |Contributing Guidelines]].<br />
<br />
This list is not exclusive -- there are many other things that might be good projects, but it might instead be something we already have. Also, some of the following items may not actually be considered good ideas now. So please check with octave-maintainers@octave.org before you start working on some large project.<br />
<br />
Summer of Code students, please also see [[SoC Project Ideas]].<br />
<br />
If you're looking for small project, something more suited to start getting involved with Octave development or to fill a boring evening, see [[short projects]]<br />
<br />
=Numerical=<br />
<br />
* Use C++11 <random> libraries for random number generation. Write link between Octave functions (rand, randi, randn, rande) and C++ API. Implement RandStream objects as Matlab does.<br />
<br />
*Improve logm, and sqrtm (see this thread: http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html)<br />
<br />
*Use pairwise addition in sum() to mitigate against numerical errors without substantial performance penalty (https://en.wikipedia.org/wiki/Pairwise_summation).<br />
<br />
*Review implementing algorithm in this 2009 paper (https://epubs.siam.org/doi/pdf/10.1137/080738490) for xsum (sum with extra accuracy). The existing implementation uses a 2005 paper.<br />
<br />
*Improve complex mapper functions. See W. Kahan, ``Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit (in The State of the Art in Numerical Analysis, eds. Iserles and Powell, Clarendon Press, Oxford, 1987) for explicit trigonometric formulae. See {{patch|8172}} for a previous attempt.<br />
<br />
*Make functions like gamma() return the right IEEE Inf or NaN values for extreme args or other undefined cases.<br />
<br />
*Improve sqp.<br />
<br />
*Fix CollocWt? to handle Laguerre polynomials. Make it easy to extend it to other polynomial types.<br />
<br />
*Add optional arguments to colloc so that it's not restricted to Legendre polynomials.<br />
<br />
*Move rand, eye, xpow, xdiv, etc., functions to the matrix classes.<br />
<br />
*Improve design of ODE, DAE, classes.<br />
<br />
*Make QR more memory efficient for large matrices when not all the columns of Q are required (apparently this is not handled by the lapack code yet).<br />
<br />
*Evaluate harmonics and cross-correlations of unevenly sampled and nonstationary time series, as in http://www.jstatsoft.org/v11/i02 (which has C code with interface to R). (This is now partly implemented in the [http://octave.sourceforge.net/lssa/index.html lssa] package.)<br />
<br />
<!-- == General purpose Finite Element library ==<br />
<br />
Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes,<br />
namely the [[bim package]] which relies on the [http://octave.sf.net/msh msh package] (which is in turn based on [http://geuz.org/gmsh/ gmsh]) for creating and managing 2D triangular and 3D tetrahedral meshes and on the [http://octave.sf.net/fpl fpl package] for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with [http://www.paraview.org Paraview] or [https://wci.llnl.gov/codes/visit/ 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.<br />
The [http://geopdes.sf.net GeoPDEs] project, on the other hand, offers a complete suite of functions for discretizing a wide range of<br />
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 [http://geopdes.sf.net 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 [http://fenicsproject.org/documentation/ FEniCS] based on the existing C++ or Python interfaces. This second approach has been developed during the GSOC 2013 and the Octave-Forge package [http://octave.sf.net/fem-fenics fem-fenics] is now available. However, fem-fenics could be extended in many different ways:<br />
* implement the bindings for the UFL language inside Octave<br />
* add new functions already available with Fenics but not yet in Octave<br />
* create new functions specifically suited for Octave<br />
* improve the efficiency of the code<br />
The main goal for the fem-fenics package is ultimately to be merged with the FEnics project itself, so that it can remain in-sync with the main library development. --><br />
<br />
== Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D ==<br />
<br />
The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function <tt>pdepe</tt>. A good starting point is the [http://en.wikipedia.org/wiki/Method_of_lines method of lines] for which you can find more details [http://en.wikibooks.org/wiki/Partial_Differential_Equations/Method_of_Lines here] and [http://www.scholarpedia.org/article/Method_of_lines here], whereas an example implementation can be found [http://www.scholarpedia.org/article/Method_of_Lines/Example_Implementation here]. In addition, [http://www.pdecomp.net/ this page] provides some useful material.<br />
<br />
== Implement solver for 1D nonlinear boundary value problems ==<br />
<br />
The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package<br />
by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver.<br />
Details on the methods to be implemented can be found in [http://dx.doi.org/10.1145/502800.502801 this paper] on bvp4c and [http://www.jnaiam.net/new/uploads/files/014dde86eef73328e7ab674d1a32aa9c.pdf this paper] on bvp5c. Further details are available in [http://books.google.it/books/about/Nonlinear_two_point_boundary_value_probl.html?id=s_pQAAAAMAAJ&redir_esc=y this book].<br />
<br />
<!-- == Geometric integrators for Hamiltonian Systems ==<br />
<br />
[http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration Geometric (AKA Symplectic) integrators] are useful for <br />
multi-dimensional classical mechanics problems and for molecular dynamics simulations.<br />
The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently<br />
specifically suited for second order problems in general and Hamiltonian systems in particular.<br />
Therefore a new package for geometric integrators would be a useful contribution.<br />
This could be created as new package or added as a set of new functions for odepkg.<br />
The function interface should be consistent throughout the package and should be modeled to follow <br />
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.<br />
An initial list of methods to be implemented includes (but is not limited to)<br />
* Symplectic Euler methods, see [http://en.wikipedia.org/wiki/Semi-implicit_Euler_method here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Störmer-Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Velocity Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Symplectic partitioned Runge-Kutta methods, see [http://reference.wolfram.com/mathematica/tutorial/NDSolveSPRK.html here] or [http://dx.doi.org/10.1137/0733019 here]<br />
* Spectral Variational Integrator methods, see [http://www3.nd.edu/~izaguirr/papers/acta_numerica.pdf here] or [http://www.math.ucsd.edu/~mleok/pdf/HaLe2012_SVI.pdf here]<br />
<br />
For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker.<br />
Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.<br />
* SHAKE, see [http://en.wikipedia.org/wiki/Constraint_algorithm here] or [http://dx.doi.org/10.1016/0021-9991(77)90098-5 here]<br />
* RATTLE, see [http://dx.doi.org/10.1016/0021-9991(83)90014-1 here] or [http://dx.doi.org/10.1002/jcc.540161003 here]<br />
--><br />
<br />
== Matlab-compatible ODE solvers in core-Octave ==<br />
<br />
* <strike> 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. </strike><br />
* <strike> Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core. </strike><br />
* <strike> Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [https://savannah.gnu.org/patch/?8102 here] 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. </strike><br />
* Improve handling of sparse Jacobians in IDE/DAE solvers<br />
** Currently, in the IDA wrapper function __ode15__ an over conservative guess for the amount of memory to be allocated when assembling a sparse jacobian is used, essentially allocating enough space for a full jacobian then freeing the excess memory, an initial patch for fixing this has been posted on the tracker, for integrating this into Octave it must be generalized to support prior versions of SUNDIALS<br />
** Currently Jacobians passed by the user in Octave's sparse matrix format are copied into SUNDIALS own sparse matrix format. Newer versions of SUNDIALS (5.x or higher) support letting the user take care of the linear algebra data structures and methods thus removing the need for the copy. Taking advantage of this feature would improve the solver performance both in terms of memory footprint and speed.[https://savannah.gnu.org/bugs/?func=detailitem&item_id=55905 tracker post about memory allocation] [https://computing.llnl.gov/projects/sundials/release-history SUNDIALS release history]<br />
* Implement Matlab compatible versions of "deval".<br />
<br />
== High Precision Arithmetic Computation ==<br />
<br />
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-conditioned. 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<br />
<br />
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.<br />
<br />
=GUI/IDE=<br />
<br />
*Søren Hauberg has suggested that we need C++ code that can:<br />
**Determine if a line of code could be fully parsed, i.e. it would return true for "plot (x, y);", but false for "while (true)".<br />
**Evaluate a line of code and return the output as a string (it would be best if it could provide three strings: output, warnings and errors).<br />
**Query defined variables, i.e. get a list of currently defined variables. Bonus points if it could tell you if anything had changed since the last time you checked the variables (could also be done with signals).<br />
* Create a better (G)UI for the {{manual|profile|profiler}}. This may be done with Qt, but not necessarily.<br />
<br />
== GUI Variable Editor and Property Inspector ==<br />
<br />
Octave has a preliminary implementation of a Variable Editor: a spreadsheet-like tool for quickly editing and visualizing variables. The initial phase of the project will be learning how the implementation was done.<br />
<br />
With the knowledge gained, the second part of the project will be to implement a Property Inspector. This is a spreadsheet like interface to the many, many graphics properties that exist and are different on a per-object basis. The goal would be not only the concise-display of the existing properties, but a reasonable user interface to change them. As examples, Boolean properties should be able to be toggled with a double-click; Radio properties should have a drop-down list of only the supported options; Other properties that can be modified should have the constraints built-in (for example, Linewidth must be a scalar, while Position must be a 1x4 vector). It would also be important to have easy access to the documentation of a property.<br />
<br />
For reference, Matlab has a similar Property Inspector (https://www.mathworks.com/help/matlab/ref/inspect.html).<br />
<br />
== Sisotool. Create a graphical design tool for tuning closed loop control system ([[Control package]])==<br />
<br />
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.<br />
Recently, some implementation was done during [[Summer_of_Code#GSoC_2018|GSoC 2018]], see https://eriveltongualter.github.io/GSoC2018/final.html for details.<br />
<br />
=Sparse Matrices=<br />
<br />
The paper by [http://arxiv.org/abs/cs.MS/0604006 Bateman & Adler] is good reading for understanding the sparse matrix implementation.<br />
<br />
*Improve Matlab compatibility for {{manual|sprandsym}}.<br />
<br />
*Sparse logical indexing in idx_vector class so that something like <code>a = sprandn (1e6, 1e6, 1e-6); a(a<1) = 0;</code> won't cause a memory overflow.<br />
<br />
*Other missing Functions<br />
**lsqr<br />
**minres<br />
**symmlq<br />
<br />
== SPQR Interface ==<br />
<br />
Octave implements QR factorization for sparse matrices, but it does so with an older "CXSPARSE" library. This has caused fundamental issues, including segfaults as recorded here (bugs {{bug|51950}} and {{bug|57033}}). The goal of this project is to program an interface to the API for the SQPR library (http://faculty.cse.tamu.edu/davis/suitesparse.html). This is the same library that Matlab uses for this purpose.<br />
<br />
*Improve QR factorization functions, using idea based on CSPARSE cs_dmsol.m<br />
<br />
*Improve QR factorization by replacing CXSPARSE code with SPQR code, and make the linear solve return 2-norm solutions for ill-conditioned matrices based on this new code<br />
<br />
=Strings=<br />
<br />
*Consider making octave_print_internal() print some sort of text representation for unprintable characters instead of sending them directly to the terminal. (But don't do this for fprintf!)<br />
<br />
*Consider changing the default value of `string_fill_char' from SPC to NUL.<br />
<br />
=Other Data Types=<br />
<br />
*Template functions for mixed-type ops.<br />
<br />
*Convert other functions for use with the floating point type including quad, dasrt, daspk, etc.<br />
<br />
=Input/Output=<br />
<br />
*Make fread and fwrite work for complex data. Iostreams based versions of these functions would also be nice, and if you are working on them, it would be good to support other size specifications (integer*2, etc.).<br />
<br />
*Move some pr-output stuff to liboctave.<br />
<br />
*Make the cutoff point for changing to packed storage a user-preference variable with default value 8192.<br />
<br />
*Complain if there is not enough disk space available (I think there is simply not enough error checking in the code that handles writing data).<br />
<br />
*Make it possible to tie arbitrary input and output streams together, similar to the way iostreams can be tied together.<br />
<br />
*Expand {{codeline|imwrite}} options. This shouldn't be too hard to implement, since it's wrapped around GraphicsMagick.<br />
<br />
*Extend Octave functions to work on stored arrays that are too big to fit in RAM, similar to available R [http://www.bigmemory.org/ packages.]<br />
<br />
* write {{codeline|xmlread}} and {{codeline|xmlwrite}}. This could be done using [http://xerces.apache.org/xerces-c/ Xerces C++ interface] which apparently is what [http://octave.1599824.n4.nabble.com/xml-in-octave-td4663034.html Matlab uses].<br />
<br />
* Implement hdf5 for .mat files (see [http://octave.1599824.n4.nabble.com/Reading-Matlab-td4650158.html this thread]).<br />
<br />
=Interpreter=<br />
<br />
The interpreter is written in C++, undocumented. There are many possible projects associated with it.<br />
<br />
'''Required skills''': ''Very good'' C and C++ knowledge, possibly also understanding of [http://en.wikipedia.org/wiki/Gnu_bison GNU bison] and [http://en.wikipedia.org/wiki/Flex_lexical_analyser 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.<br />
<br />
*Allow customization of the debug prompt.<br />
<br />
*Fix the parser so that<br />
<br />
if (expr) 'this is a string' end<br />
<br />
is parsed as IF expr STRING END. ''(see [https://lists.gnu.org/archive/html/octave-maintainers/2014-03/msg00087.html this] post on the mailing list)''<br />
<br />
*Clean up functions in input.cc that handle user input (there currently seems to be some unnecessary duplication of code and it seems overly complex).<br />
<br />
*Consider allowing an arbitrary property list to be attached to any variable. This could be a more general way to handle the help string that can currently be added with `document'.<br />
<br />
*Allow more command line options to be accessible as built-in variables (--echo-commands, etc.).<br />
<br />
*Make the interpreter run faster.<br />
<br />
*Allow arbitrary lower bounds for array indexing.<br />
<br />
*Improve performance of recursive function calls.<br />
<br />
*Improve the way ignore_function_time_stamp works to allow selecting by individual directories or functions.<br />
<br />
*Add a command-line option to tell Octave to just do syntax checking and not execute statements.<br />
<br />
*Clean up symtab and variable stuff.<br />
<br />
*Input stream class for parser files -- must manage buffers for flex and context for global variable settings.<br />
<br />
*make parser do more semantic checking, continue after errors when compiling functions, etc.<br />
<br />
*Make LEXICAL_ERROR have a value that is the error message for parse_error() to print?<br />
<br />
*Add a run-time alias mechanism that would allow things like alias fun function_with_a_very_long_name so that `function_with_a_very_long_name' could be invoked as `fun'.<br />
<br />
*Allow local changes to variables to be written more compactly than is currently possible with unwind_protect. For example, <br />
<br />
function f ()<br />
local prefer_column_vectors = something;<br />
...<br />
endfunction<br />
<br />
<br />
would be equivalent to<br />
<br />
function f ()<br />
save_prefer_column_vectors = prefer_column_vectors;<br />
unwind_protect<br />
prefer_column_vectors = something;<br />
...<br />
unwind_protect_cleanup<br />
prefer_column_vectors = save_prefer_column_vectors;<br />
end_unwind_protect<br />
endfunction<br />
<br />
<br />
*Fix all function files to check for bogus inputs (wrong number or types of input arguments, wrong number of output arguments).<br />
<br />
*Handle options for built-in functions more consistently.<br />
<br />
*Too much time is spent allocating and freeing memory. What can be done to improve performance?<br />
<br />
Use move constructors rather than copy constructors for things like dim_vectors which are repeatedly created just to initialize Array or Matrix objects.<br />
<br />
*Error output from Fortran code is ugly. Something should be done to make it look better.<br />
<br />
*It would be nice if output from the Fortran routines could be passed through the pager.<br />
<br />
*Attempt to recognize common subexpressions in the parser.<br />
<br />
*Consider making it possible to specify an empty matrix with a syntax like [](e1, e2). Of course at least one of the expressions must be zero...<br />
<br />
*Is Matrix::fortran_vec() really necessary?<br />
<br />
*Rewrite whos and the symbol_record_info class. Write a built-in function that gives all the basic information, then write who and whos as M-files.<br />
<br />
*On systems that support matherr(), make it possible for users to enable the printing of warning messages.<br />
<br />
*Make it possible to mark variables and functions as read-only.<br />
<br />
*Make it possible to write a function that gets a reference to a matrix in memory and change one or more elements without generating a second copy of the data.<br />
<br />
*Use nanosleep instead of usleep if it is available? Apparently nanosleep is to be preferred over usleep on Solaris systems.<br />
<br />
*<strike>Per the following discussion, allow bsxfun style singleton dimension expansion as the default behavior for the builtin element-wise operators: http://octave.1599824.n4.nabble.com/Vector-approach-to-row-margin-frequencies-tp1636361p1636367.html</strike> This is done. <strike>Now [[User:JordiGH|I]] just have to document it.</strike> This is done too!<br />
<br />
== Improve JIT compiling ==<br />
<br />
Octave's interpreter is ''very'' slow on some loops. Recently, thanks to Max Brister's work, an initial implementation of a just-in-time compiler (JITC) in [http://llvm.org 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. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation. See also [[JIT]].<br />
<br />
== Improve memory management ==<br />
<br />
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.<br />
<br />
== Implement classdef classes ==<br />
<br />
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 classdef classes in version 4.0, refer to the [[Classdef|classdef status page]] for what is not yet implemented. There is irregular work here, and classdef is [http://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html a very] [http://www.mathworks.com/help/matlab/events-sending-and-responding-to-messages.html complicated] [http://www.mathworks.com/help/matlab/enumeration-classes.html 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.<br />
<br />
Although there's already a substantial classdef support in current octave code base, there are still many areas that are unimplemented or need improvements. The main ones that come to my mind are:<br />
* support for events<br />
* support for enums<br />
* support for "import" (this requires good understanding of octave internals, especially the symbol table)<br />
* improving multiple inheritance and method resolution<br />
* honoring and computing "Sealed" attribute<br />
* support for function handle to methods<br />
<br />
== Improve MPI package ==<br />
<br />
Octave Forge's [http://octave.sourceforge.net/mpi/index.html MPI package] <br />
is a wrapper for basic MPI functions for parallel computing. It is implemented <br />
by wrapping MPI function calls in simple DLD functions that map Octave's Datataypes to <br />
MPI Derived Datatypes. <br />
The proposed project deals with improving and extending the Octave MPI package, for example:<br />
* Octave MPI applications can currently be only run in batch mode, add the ability to launch parallel jobs and collect their output in an interactive Octave session.<br />
* Implement functions for non-blocking communication (MPI_Isend, MPI_Irecv)<br />
* Implement one-to-many (Broadcast, Scatter), many-to-one (Reduce, Gather), and many-to-many (All Reduce, Allgather) communication routines<br />
<br />
=Graphics=<br />
<br />
*Correctly handle case where DISPLAY is unset. Provide --no-window-system or --nodisplay (?) option. Provide --display=DISPLAY option? How will this work with gnuplot (i.e., how do we know whether gnuplot requires an X display to display graphics)?<br />
<br />
* Implement transparency and lighting in OpenGL backend(s). A basic implementation was available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of octave.<br />
<br />
* Implement a Cairo-based renderer for 2D-only graphics, with support for PS/PDF/SVG output (for printing).<br />
<br />
* On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.<br />
<br />
* Add map-creating capabilities similar to the Matlab [http://www.mathworks.com/help/map/functionlist.html Mapping toolbox] for inclusion in the Octave Forge [https://sourceforge.net/p/octave/mapping mapping package].<br />
<br />
* Add data cursor to trace data values in figure.<br />
<br />
== Lighting ==<br />
<br />
Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.<br />
<br />
== Object selection in OpenGL renderer ==<br />
<br />
This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [http://glprogramming.com/red/chapter13.html]<br />
<br />
== Non-OpenGL renderer ==<br />
<br />
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:<br />
* [http://qt.nokia.com Qt]: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [https://github.com/goffioul/QtHandles]<br />
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.<br />
<br />
== TeX/LaTeX markup ==<br />
<br />
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.<br />
<br />
* 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,<br />
<br />
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre><br />
<br />
:Would be rendered as,<br />
<br />
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup><br />
<br />
:This is analogous to how special characters may be included in a wiki using html.<br />
<br />
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre><br />
<br />
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].<br />
<br />
* 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.<br />
<br />
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html 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 [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.<br />
<br />
=History=<br />
<br />
*Add an option to allow saving input from script files in the history list.<br />
<br />
*The history command should accept two numeric arguments to indicate a range of history entries to display, save or read.<br />
<br />
*Avoid writing the history file if the history list has not changed.<br />
<br />
*Avoid permission errors if the history file cannot be opened for writing.<br />
<br />
*Fix history problems — core dump if multiple processes are writing to the same history file?<br />
<br />
=Configuration and Installation=<br />
<br />
*Makefile changes:<br />
**eliminate for loops<br />
**define shell commands or eliminate them<br />
**consolidate targets<br />
<br />
*Create a docs-only distribution?<br />
<br />
*<strike> Convert build system to a non-recursive Automake setup. See how Makefile.am files currently include module.mk files in subdirectories, extend this concept to the entire project so there is only one top-level Makefile.am. </strike> Done, except for special dir libgnu which is the only SUBDIRS listed in configure.ac.<br />
<br />
=Documentation and On-Line Help=<br />
<br />
*Improve the Texinfo Documentation for the interpreter. It would be useful to have lots more examples, to not have so many forward references, and to not have very many simple lists of functions.<br />
<br />
*[[Doxygen]] documentation for the C++ classes.<br />
<br />
*Make index entries more consistent to improve behavior of <code>help -i</code>.<br />
<br />
*Make <code>help -i</code> try to find a whole word match first.<br />
<br />
*Add more demo files.<br />
<br />
*Flesh out this wiki<br />
<br />
=Tests=<br />
*Improved set of tests: [http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=370633]<br />
**Tests for various functions. Would be nice to have a test file corresponding to every function (see below)<br />
**Tests for element by element operators: + - .* ./ .\ .^ | & < <= == >= > != !<br />
**Tests for boolean operators: && ||<br />
**Tests for other operators: * / \ ' .'<br />
**Tests from bug reports.<br />
**Tests for indexed assignment. Need to consider the following:<br />
***fortran-style indexing<br />
***zero-one indexing<br />
***assignment of empty matrix as well as values resizing<br />
**Tests for all internal functions.<br />
<br />
* Implement a coverage tool for collecting coverage data and generating code coverage reports on m-file functions and scripts. This would be very useful for Octave development as well as for users who want a code coverage report for their own functions and scripts.<br />
<br />
We are far from even having one test for every function, so focus should be on getting the breadth of coverage first before trying to get the depth of 100% statement coverage. As of Dec 2015, 202 of 1020 m-files have no tests. Some of these will be plotting functions which have demos instead, but that leaves enough functions to be an interesting project. As of Dec 2015, there are 485 instances of C++ functions which need tests.<br />
<br />
After Octave is compiled, running the {{Codeline|make check}} build target will run the full test suite and generate a file called test/fntests.log in the build directory with a summary of the results. At the end of the file is a list of all functions for which no tests were found. An extract is posted in the [[files missing tests]] page. If you are not building Octave yourself, the test suite can be run on an installed binary copy by executing the {{Codeline|__run_test_suite__}} command at the Octave prompt. The fntests.log file will be written in the current directory in this case.<br />
<br />
There also need to be tests for functions written in the C++ files. See [[Add_BIST_tests_for_octave_functions_written_in_C%2B%2B]] for instructions and a list of instances.<br />
<br />
See also [[Continuous Build#Coverage Report]].<br />
<br />
=Programming=<br />
<br />
*Better error messages for missing operators?<br />
<br />
*Eliminate duplicate enums in pt-exp.cc, pt-const.cc, and ov.cc.<br />
<br />
*Handle octave_print_internal() stuff at the liboctave level. Then the octave_value classes could just call on the print() methods for the underlying classes.<br />
<br />
*As much as possible, eliminate explicit checks for the types of octave_value objects so that user-defined types will automatically do the right thing in more cases.<br />
<br />
*Only include config.h in files that actually need it, instead of including it in every .cc file. Unfortunately, this might not be so easy to figure out.<br />
<br />
*GNU coding standards:<br />
**Add a `Makefile' target to the Makefiles.<br />
**Comments on #else and #endif preprocessor commands.<br />
**Change error message format to match standards everywhere.<br />
<br />
*Eliminate more global variables.<br />
<br />
*Move procstream to liboctave.<br />
<br />
*Use references and classes in more places.<br />
<br />
*Share more code among the various _options functions.<br />
<br />
*Use non-empty identifiers in all warnings and errors issued by Octave, see [[Easy projects#Miscellaneous]].<br />
<br />
*Reduce the amount of datatypes in liboctave.<br />
<br />
=Miscellaneous=<br />
<br />
*Implement some functions for interprocess communication: bind, accept, connect, gethostbyname, etc. (This functionality is already available in the octave sockets package, what is the purpose of moving it to core octave?)<br />
<br />
*The ability to transparently handle very large files: Juhana K Kouhia <kouhia@nic.funet.fi> wrote:<br />
*: If I have a one-dimensional signal data with the size 400 Mbytes, then what are my choices to operate with it:<br />
*:*I have to split the data<br />
*:*Octave has a virtual memory on its own and I don't have to worry about the splitting.<br />
*:If I split the data, then my easily programmed processing programs will become hard to program.<br />
*:If possible, I would like to have the virtual memory system in Octave i.e., the all big files, the user see as one big array or such. There could be several user selectable models to do the virtual memory depending on what kind of data the user have (1d, 2d) and in what order they are processed (stream or random access).<br />
<br />
*An interface to gdb. Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote:<br />
*:I was thinking about a tool, which could be very useful for me in my numerical simulation work. It is an interconnection between gdb and octave. We are often managing very large arrays of data in our fortran or c codes, which might be studied with the help of octave at the algorithm development stages. Assume you're coding, say, wave equation. And want to debug the code. It would be great to pick some array from the memory of the code you're developing, fft it and see the image as a log-log plot of the spectral density. I'm facing similar problems now. To avoid high c-development cost, I develop in matlab/octave, and then rewrite into c. It might be so much easier, if I could off-load a c array right from the debugger into octave, study it, and, perhaps, change some [many] values with a convenient matlab/octave syntax, similar to <code>a(:,51:250)=zeros(100,200)</code>, and then store it back into the memory of my c code.<br />
<br />
*Implement gdb extensions for Octave types. Octave has the <code>etc/gdbinit</code> file, which has some basic support for displaying the contents of Octave types. Add more extensions to make it easier to debug octave_values and other Octave types.<br />
<br />
*Add a definition to lgrind so that it supports Octave. (See http://www.tex.ac.uk/tex-archive/support/lgrind/ for more information about lgrind.)<br />
<br />
*Spatial statistics, including covariogram estimation and kriging -- perhaps via an interface to [http://www.gstat.org/ gstat]?<br />
<br />
* the [http://octave.sourceforge.net/miscellaneous/function/units.html units] function from the miscellaneous package works by parsing the output of from a call to GNU units. This can be made much more robust by writing it in C++ and including its library "units.h"<br />
<br />
=Marketing and Community=<br />
<br />
* Make the Octave website/[[Project Infrastructure]] easier to maintain.<br />
<br />
* Make it easier for newcomers to contribute.<br />
<br />
* For marketing ideas, see the [https://openoffice.apache.org/orientation/intro-marketing.html Apache Open Office Introduction to Marketing]<br />
<br />
* Help design a user or a [https://www.openoffice.org/marketing/ooocon2006/presentations/wednesday_c10.pdf developer survey]<br />
<br />
* Help prepare and deliver presentations and [[Publications about Octave]] at colleges and universities.<br />
<br />
* Create a [[Forum for GNU Octave]].<br />
<br />
== Improve Windows binary packaging ==<br />
<br />
We are currently able to build and provide a [[Windows Installer|installer for Windows]]. The build process involves cross-compiling on a Linux system using a fork of the [http://mxe.cc/ MXE] project to build Octave and all of its dependencies. Any ideas for improving this process to make it easier or faster, or to improve the installer itself or the installation experience for Windows users would be appreciated.<br />
<br />
'''Skills Required''': Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. No m-scripting or C++ necessary, beyond understanding [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
== Improve macOS binary packaging ==<br />
<br />
We would like to be able to easily generate binary packages for macOS. Right now, it's difficult and tedious to do so. Most OS X users install Octave using one of the source-based package managers such as Homebrew or MacPorts. Any way to help us build a binary package would be appreciated. Required knowledge is understanding how building binaries in macOS works. Our current approach to building binaries for Windows is to cross-compile from a GNU system using [http://mxe.cc/ MXE], something similar may be possible for OS X ([http://lilypond.org/gub/ GUB]?).<br />
<br />
'''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 [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
=Performance=<br />
<br />
*A profiler for Octave would be a very useful tool. And now we have one! But it really needs a better interface.<br />
*Having {{Codeline|parfor}} functioning would speed code development and execution now that multicore architectures are widespread. See [http://octave.1599824.n4.nabble.com/Parfor-td4630575.html here] and [http://stackoverflow.com/questions/24970519/how-to-use-parallel-for-loop-in-octave-or-scilab here]. Existing code from the [[Parallel package | parallel]] and [http://octave.sourceforge.net/mpi/index.html mpi] packages could perhaps be adapted for this.<br />
<br />
=Packaging=<br />
<br />
* create a system that allows packages to deprecate functions as in core. Possibilities are:<br />
** get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated<br />
** PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release<br />
** the package developer can also use something like Make to create a ''normal'' package from something that actually had a more complex structure, inclusive deprecated directories<br />
* get pkg to resolve dependencies automatically by downloading and installing them too<br />
* allow to download and install multiple versions of the same package<br />
* make the package just a bit more verbose by default (specifics?)<br />
* make pkg a little more like apt-get (what specific features of apt-get is this referring to?)<br />
* make pkg support more than one src directory<br />
** subdirectories with makefiles and top level make command of: cd <subdir> && ${MAKE}... ok as a substitute?<br />
* make pkg able to supply extra configure and make flags, useful for distributions, including -j for make (pkg now passes --jobs=N automatically, CFLAGS and CXXFLAGS environment variables are already respected, what's missing?)<br />
<br />
=Preferences=<br />
<br />
Octave has several functions for managing user preferences. Many function use persistent variables instead of relying upon the preference features.<br />
* The function {{Codeline|edit ()}} contains a persistent structure used as its personal set of preferences. These can all be moved to the user preference group for the editor.<br />
** "EDITOR"<br />
** "HOME"<br />
** "AUTHOR"<br />
** "EMAIL"<br />
** "LICENSE"<br />
** "MODE"<br />
** "EDITINPLACE"<br />
* The {{Codeline|savepath ()}} function modifies the startup script (rcfile), {{Codeline|~/.octaverc}} and inserts commands to allow the next session to begin with the same path. Instead user preference can be created for startup items and a preference for the user specified path can be added. Perhaps two path preferences should be used. One for the elements that should precede the core path and those that should follow. A start up directory preference might also be added to allow the user to specify where Octave should begin the next session.<br />
** "PREPATH"<br />
** "POSTPATH"<br />
** "STARTUPDIR"<br />
* A preference group for plotting can also be added. A preference for the default terminal would be useful for those who want to override the default. Preferences for the default {{Codeline|graphicstoolkit}} can also be added.<br />
** GNUPLOTTERM<br />
** GRAPHICSTOOLKIT<br />
* A preference group for printing can include preferences for the default printer, the ghostscript command, and possibly other parameters like orientation, and resolution.<br />
** PRINTER<br />
** GHOSTSCRIPTCOMMAND<br />
** ORIENTATION<br />
** RESOLUTION<br />
* Searching the m-files for use of {{Codeline|persistent}} should turn up other opportunities to use preferences.<br />
<br />
=Bugs=<br />
<br />
There are always bugs to fix. The [https://savannah.gnu.org/bugs/?group=octave bug tracker] is a good place to find tasks needing a hand. See also [[Short projects#Bugs]].<br />
<br />
= Matlab compatibility =<br />
<br />
== Missing functions ==<br />
<br />
There are certain functions present in MATLAB known to be missing in Octave.<br />
<br />
One list is provided on the source for function __unimplemented.m__, subfunction missing_functions; it can be edited in the Octave GUI or browsed at [http://hg.savannah.gnu.org/hgweb/octave/file/default/scripts/help/__unimplemented__.m#l547].<br />
<br />
Lists are also kept for [[:Category:Missing functions|several packages]].<br />
<br />
It is also possible to look at existing [[Wikipedia:Free and open-source software|FOSS]] implementations, from FreeMat and Scilab (for more closely compatible languages) to R or Scipy or Julia (for less compatible versions). Obviously, it is NOT OK to look at the Matlab implementation since this is not [[Wikipedia:Free software|free software]]!<br />
<br />
== Functions under different name ==<br />
<br />
Many Octave Forge functions perform the same as functions from matlab packages. However, they often exist under a different name or have incompatible API's. Often fixing this is a matter of changing their names, swap the order of their input arguments. At least, a list of this functions would be helpful.<br />
<br />
<br />
<br />
[[Category:Development]]<br />
[[Category:Project Ideas]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Projects&diff=12628Projects2020-02-04T09:42:34Z<p>Cdf: /* Geometric integrators for Hamiltonian Systems */</p>
<hr />
<div>The list below summarizes features or bug fixes we would like to see in Octave. if you start working steadily on a project, please let octave-maintainers@octave.org know. We might have information that could help you. You should also read the [[Contribution guidelines |Contributing Guidelines]].<br />
<br />
This list is not exclusive -- there are many other things that might be good projects, but it might instead be something we already have. Also, some of the following items may not actually be considered good ideas now. So please check with octave-maintainers@octave.org before you start working on some large project.<br />
<br />
Summer of Code students, please also see [[SoC Project Ideas]].<br />
<br />
If you're looking for small project, something more suited to start getting involved with Octave development or to fill a boring evening, see [[short projects]]<br />
<br />
=Numerical=<br />
<br />
* Use C++11 <random> libraries for random number generation. Write link between Octave functions (rand, randi, randn, rande) and C++ API. Implement RandStream objects as Matlab does.<br />
<br />
*Improve logm, and sqrtm (see this thread: http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html)<br />
<br />
*Use pairwise addition in sum() to mitigate against numerical errors without substantial performance penalty (https://en.wikipedia.org/wiki/Pairwise_summation).<br />
<br />
*Review implementing algorithm in this 2009 paper (https://epubs.siam.org/doi/pdf/10.1137/080738490) for xsum (sum with extra accuracy). The existing implementation uses a 2005 paper.<br />
<br />
*Improve complex mapper functions. See W. Kahan, ``Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit (in The State of the Art in Numerical Analysis, eds. Iserles and Powell, Clarendon Press, Oxford, 1987) for explicit trigonometric formulae. See {{patch|8172}} for a previous attempt.<br />
<br />
*Make functions like gamma() return the right IEEE Inf or NaN values for extreme args or other undefined cases.<br />
<br />
*Improve sqp.<br />
<br />
*Fix CollocWt? to handle Laguerre polynomials. Make it easy to extend it to other polynomial types.<br />
<br />
*Add optional arguments to colloc so that it's not restricted to Legendre polynomials.<br />
<br />
*Move rand, eye, xpow, xdiv, etc., functions to the matrix classes.<br />
<br />
*Improve design of ODE, DAE, classes.<br />
<br />
*Make QR more memory efficient for large matrices when not all the columns of Q are required (apparently this is not handled by the lapack code yet).<br />
<br />
*Evaluate harmonics and cross-correlations of unevenly sampled and nonstationary time series, as in http://www.jstatsoft.org/v11/i02 (which has C code with interface to R). (This is now partly implemented in the [http://octave.sourceforge.net/lssa/index.html lssa] package.)<br />
<br />
<!-- == General purpose Finite Element library ==<br />
<br />
Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes,<br />
namely the [[bim package]] which relies on the [http://octave.sf.net/msh msh package] (which is in turn based on [http://geuz.org/gmsh/ gmsh]) for creating and managing 2D triangular and 3D tetrahedral meshes and on the [http://octave.sf.net/fpl fpl package] for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with [http://www.paraview.org Paraview] or [https://wci.llnl.gov/codes/visit/ 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.<br />
The [http://geopdes.sf.net GeoPDEs] project, on the other hand, offers a complete suite of functions for discretizing a wide range of<br />
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 [http://geopdes.sf.net 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 [http://fenicsproject.org/documentation/ FEniCS] based on the existing C++ or Python interfaces. This second approach has been developed during the GSOC 2013 and the Octave-Forge package [http://octave.sf.net/fem-fenics fem-fenics] is now available. However, fem-fenics could be extended in many different ways:<br />
* implement the bindings for the UFL language inside Octave<br />
* add new functions already available with Fenics but not yet in Octave<br />
* create new functions specifically suited for Octave<br />
* improve the efficiency of the code<br />
The main goal for the fem-fenics package is ultimately to be merged with the FEnics project itself, so that it can remain in-sync with the main library development. --><br />
<br />
== Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D ==<br />
<br />
The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function <tt>pdepe</tt>. A good starting point is the [http://en.wikipedia.org/wiki/Method_of_lines method of lines] for which you can find more details [http://en.wikibooks.org/wiki/Partial_Differential_Equations/Method_of_Lines here] and [http://www.scholarpedia.org/article/Method_of_lines here], whereas an example implementation can be found [http://www.scholarpedia.org/article/Method_of_Lines/Example_Implementation here]. In addition, [http://www.pdecomp.net/ this page] provides some useful material.<br />
<br />
== Implement solver for 1D nonlinear boundary value problems ==<br />
<br />
The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package<br />
by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver.<br />
Details on the methods to be implemented can be found in [http://dx.doi.org/10.1145/502800.502801 this paper] on bvp4c and [http://www.jnaiam.net/new/uploads/files/014dde86eef73328e7ab674d1a32aa9c.pdf this paper] on bvp5c. Further details are available in [http://books.google.it/books/about/Nonlinear_two_point_boundary_value_probl.html?id=s_pQAAAAMAAJ&redir_esc=y this book].<br />
<br />
<!-- == Geometric integrators for Hamiltonian Systems ==<br />
<br />
[http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration Geometric (AKA Symplectic) integrators] are useful for <br />
multi-dimensional classical mechanics problems and for molecular dynamics simulations.<br />
The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently<br />
specifically suited for second order problems in general and Hamiltonian systems in particular.<br />
Therefore a new package for geometric integrators would be a useful contribution.<br />
This could be created as new package or added as a set of new functions for odepkg.<br />
The function interface should be consistent throughout the package and should be modeled to follow <br />
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.<br />
An initial list of methods to be implemented includes (but is not limited to)<br />
* Symplectic Euler methods, see [http://en.wikipedia.org/wiki/Semi-implicit_Euler_method here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Störmer-Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Velocity Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Symplectic partitioned Runge-Kutta methods, see [http://reference.wolfram.com/mathematica/tutorial/NDSolveSPRK.html here] or [http://dx.doi.org/10.1137/0733019 here]<br />
* Spectral Variational Integrator methods, see [http://www3.nd.edu/~izaguirr/papers/acta_numerica.pdf here] or [http://www.math.ucsd.edu/~mleok/pdf/HaLe2012_SVI.pdf here]<br />
<br />
For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker.<br />
Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.<br />
* SHAKE, see [http://en.wikipedia.org/wiki/Constraint_algorithm here] or [http://dx.doi.org/10.1016/0021-9991(77)90098-5 here]<br />
* RATTLE, see [http://dx.doi.org/10.1016/0021-9991(83)90014-1 here] or [http://dx.doi.org/10.1002/jcc.540161003 here]<br />
--><br />
<br />
== Matlab-compatible ODE solvers in core-Octave ==<br />
<br />
* <strike> 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. </strike><br />
* <strike> Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core. </strike><br />
* <strike> Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [https://savannah.gnu.org/patch/?8102 here] 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. </strike><br />
* Implement Matlab compatible versions of "deval".<br />
<br />
== High Precision Arithmetic Computation ==<br />
<br />
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-conditioned. 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<br />
<br />
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.<br />
<br />
=GUI/IDE=<br />
<br />
*Søren Hauberg has suggested that we need C++ code that can:<br />
**Determine if a line of code could be fully parsed, i.e. it would return true for "plot (x, y);", but false for "while (true)".<br />
**Evaluate a line of code and return the output as a string (it would be best if it could provide three strings: output, warnings and errors).<br />
**Query defined variables, i.e. get a list of currently defined variables. Bonus points if it could tell you if anything had changed since the last time you checked the variables (could also be done with signals).<br />
* Create a better (G)UI for the {{manual|profile|profiler}}. This may be done with Qt, but not necessarily.<br />
<br />
== GUI Variable Editor and Property Inspector ==<br />
<br />
Octave has a preliminary implementation of a Variable Editor: a spreadsheet-like tool for quickly editing and visualizing variables. The initial phase of the project will be learning how the implementation was done.<br />
<br />
With the knowledge gained, the second part of the project will be to implement a Property Inspector. This is a spreadsheet like interface to the many, many graphics properties that exist and are different on a per-object basis. The goal would be not only the concise-display of the existing properties, but a reasonable user interface to change them. As examples, Boolean properties should be able to be toggled with a double-click; Radio properties should have a drop-down list of only the supported options; Other properties that can be modified should have the constraints built-in (for example, Linewidth must be a scalar, while Position must be a 1x4 vector). It would also be important to have easy access to the documentation of a property.<br />
<br />
For reference, Matlab has a similar Property Inspector (https://www.mathworks.com/help/matlab/ref/inspect.html).<br />
<br />
== Sisotool. Create a graphical design tool for tuning closed loop control system ([[Control package]])==<br />
<br />
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.<br />
Recently, some implementation was done during [[Summer_of_Code#GSoC_2018|GSoC 2018]], see https://eriveltongualter.github.io/GSoC2018/final.html for details.<br />
<br />
=Sparse Matrices=<br />
<br />
The paper by [http://arxiv.org/abs/cs.MS/0604006 Bateman & Adler] is good reading for understanding the sparse matrix implementation.<br />
<br />
*Improve Matlab compatibility for {{manual|sprandsym}}.<br />
<br />
*Sparse logical indexing in idx_vector class so that something like <code>a = sprandn (1e6, 1e6, 1e-6); a(a<1) = 0;</code> won't cause a memory overflow.<br />
<br />
*Other missing Functions<br />
**lsqr<br />
**minres<br />
**symmlq<br />
<br />
== SPQR Interface ==<br />
<br />
Octave implements QR factorization for sparse matrices, but it does so with an older "CXSPARSE" library. This has caused fundamental issues, including segfaults as recorded here (bugs {{bug|51950}} and {{bug|57033}}). The goal of this project is to program an interface to the API for the SQPR library (http://faculty.cse.tamu.edu/davis/suitesparse.html). This is the same library that Matlab uses for this purpose.<br />
<br />
*Improve QR factorization functions, using idea based on CSPARSE cs_dmsol.m<br />
<br />
*Improve QR factorization by replacing CXSPARSE code with SPQR code, and make the linear solve return 2-norm solutions for ill-conditioned matrices based on this new code<br />
<br />
=Strings=<br />
<br />
*Consider making octave_print_internal() print some sort of text representation for unprintable characters instead of sending them directly to the terminal. (But don't do this for fprintf!)<br />
<br />
*Consider changing the default value of `string_fill_char' from SPC to NUL.<br />
<br />
=Other Data Types=<br />
<br />
*Template functions for mixed-type ops.<br />
<br />
*Convert other functions for use with the floating point type including quad, dasrt, daspk, etc.<br />
<br />
=Input/Output=<br />
<br />
*Make fread and fwrite work for complex data. Iostreams based versions of these functions would also be nice, and if you are working on them, it would be good to support other size specifications (integer*2, etc.).<br />
<br />
*Move some pr-output stuff to liboctave.<br />
<br />
*Make the cutoff point for changing to packed storage a user-preference variable with default value 8192.<br />
<br />
*Complain if there is not enough disk space available (I think there is simply not enough error checking in the code that handles writing data).<br />
<br />
*Make it possible to tie arbitrary input and output streams together, similar to the way iostreams can be tied together.<br />
<br />
*Expand {{codeline|imwrite}} options. This shouldn't be too hard to implement, since it's wrapped around GraphicsMagick.<br />
<br />
*Extend Octave functions to work on stored arrays that are too big to fit in RAM, similar to available R [http://www.bigmemory.org/ packages.]<br />
<br />
* write {{codeline|xmlread}} and {{codeline|xmlwrite}}. This could be done using [http://xerces.apache.org/xerces-c/ Xerces C++ interface] which apparently is what [http://octave.1599824.n4.nabble.com/xml-in-octave-td4663034.html Matlab uses].<br />
<br />
* Implement hdf5 for .mat files (see [http://octave.1599824.n4.nabble.com/Reading-Matlab-td4650158.html this thread]).<br />
<br />
=Interpreter=<br />
<br />
The interpreter is written in C++, undocumented. There are many possible projects associated with it.<br />
<br />
'''Required skills''': ''Very good'' C and C++ knowledge, possibly also understanding of [http://en.wikipedia.org/wiki/Gnu_bison GNU bison] and [http://en.wikipedia.org/wiki/Flex_lexical_analyser 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.<br />
<br />
*Allow customization of the debug prompt.<br />
<br />
*Fix the parser so that<br />
<br />
if (expr) 'this is a string' end<br />
<br />
is parsed as IF expr STRING END. ''(see [https://lists.gnu.org/archive/html/octave-maintainers/2014-03/msg00087.html this] post on the mailing list)''<br />
<br />
*Clean up functions in input.cc that handle user input (there currently seems to be some unnecessary duplication of code and it seems overly complex).<br />
<br />
*Consider allowing an arbitrary property list to be attached to any variable. This could be a more general way to handle the help string that can currently be added with `document'.<br />
<br />
*Allow more command line options to be accessible as built-in variables (--echo-commands, etc.).<br />
<br />
*Make the interpreter run faster.<br />
<br />
*Allow arbitrary lower bounds for array indexing.<br />
<br />
*Improve performance of recursive function calls.<br />
<br />
*Improve the way ignore_function_time_stamp works to allow selecting by individual directories or functions.<br />
<br />
*Add a command-line option to tell Octave to just do syntax checking and not execute statements.<br />
<br />
*Clean up symtab and variable stuff.<br />
<br />
*Input stream class for parser files -- must manage buffers for flex and context for global variable settings.<br />
<br />
*make parser do more semantic checking, continue after errors when compiling functions, etc.<br />
<br />
*Make LEXICAL_ERROR have a value that is the error message for parse_error() to print?<br />
<br />
*Add a run-time alias mechanism that would allow things like alias fun function_with_a_very_long_name so that `function_with_a_very_long_name' could be invoked as `fun'.<br />
<br />
*Allow local changes to variables to be written more compactly than is currently possible with unwind_protect. For example, <br />
<br />
function f ()<br />
local prefer_column_vectors = something;<br />
...<br />
endfunction<br />
<br />
<br />
would be equivalent to<br />
<br />
function f ()<br />
save_prefer_column_vectors = prefer_column_vectors;<br />
unwind_protect<br />
prefer_column_vectors = something;<br />
...<br />
unwind_protect_cleanup<br />
prefer_column_vectors = save_prefer_column_vectors;<br />
end_unwind_protect<br />
endfunction<br />
<br />
<br />
*Fix all function files to check for bogus inputs (wrong number or types of input arguments, wrong number of output arguments).<br />
<br />
*Handle options for built-in functions more consistently.<br />
<br />
*Too much time is spent allocating and freeing memory. What can be done to improve performance?<br />
<br />
Use move constructors rather than copy constructors for things like dim_vectors which are repeatedly created just to initialize Array or Matrix objects.<br />
<br />
*Error output from Fortran code is ugly. Something should be done to make it look better.<br />
<br />
*It would be nice if output from the Fortran routines could be passed through the pager.<br />
<br />
*Attempt to recognize common subexpressions in the parser.<br />
<br />
*Consider making it possible to specify an empty matrix with a syntax like [](e1, e2). Of course at least one of the expressions must be zero...<br />
<br />
*Is Matrix::fortran_vec() really necessary?<br />
<br />
*Rewrite whos and the symbol_record_info class. Write a built-in function that gives all the basic information, then write who and whos as M-files.<br />
<br />
*On systems that support matherr(), make it possible for users to enable the printing of warning messages.<br />
<br />
*Make it possible to mark variables and functions as read-only.<br />
<br />
*Make it possible to write a function that gets a reference to a matrix in memory and change one or more elements without generating a second copy of the data.<br />
<br />
*Use nanosleep instead of usleep if it is available? Apparently nanosleep is to be preferred over usleep on Solaris systems.<br />
<br />
*<strike>Per the following discussion, allow bsxfun style singleton dimension expansion as the default behavior for the builtin element-wise operators: http://octave.1599824.n4.nabble.com/Vector-approach-to-row-margin-frequencies-tp1636361p1636367.html</strike> This is done. <strike>Now [[User:JordiGH|I]] just have to document it.</strike> This is done too!<br />
<br />
== Improve JIT compiling ==<br />
<br />
Octave's interpreter is ''very'' slow on some loops. Recently, thanks to Max Brister's work, an initial implementation of a just-in-time compiler (JITC) in [http://llvm.org 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. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation. See also [[JIT]].<br />
<br />
== Improve memory management ==<br />
<br />
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.<br />
<br />
== Implement classdef classes ==<br />
<br />
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 classdef classes in version 4.0, refer to the [[Classdef|classdef status page]] for what is not yet implemented. There is irregular work here, and classdef is [http://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html a very] [http://www.mathworks.com/help/matlab/events-sending-and-responding-to-messages.html complicated] [http://www.mathworks.com/help/matlab/enumeration-classes.html 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.<br />
<br />
Although there's already a substantial classdef support in current octave code base, there are still many areas that are unimplemented or need improvements. The main ones that come to my mind are:<br />
* support for events<br />
* support for enums<br />
* support for "import" (this requires good understanding of octave internals, especially the symbol table)<br />
* improving multiple inheritance and method resolution<br />
* honoring and computing "Sealed" attribute<br />
* support for function handle to methods<br />
<br />
== Improve MPI package ==<br />
<br />
Octave Forge's [http://octave.sourceforge.net/mpi/index.html MPI package] <br />
is a wrapper for basic MPI functions for parallel computing. It is implemented <br />
by wrapping MPI function calls in simple DLD functions that map Octave's Datataypes to <br />
MPI Derived Datatypes. <br />
The proposed project deals with improving and extending the Octave MPI package, for example:<br />
* Octave MPI applications can currently be only run in batch mode, add the ability to launch parallel jobs and collect their output in an interactive Octave session.<br />
* Implement functions for non-blocking communication (MPI_Isend, MPI_Irecv)<br />
* Implement one-to-many (Broadcast, Scatter), many-to-one (Reduce, Gather), and many-to-many (All Reduce, Allgather) communication routines<br />
<br />
=Graphics=<br />
<br />
*Correctly handle case where DISPLAY is unset. Provide --no-window-system or --nodisplay (?) option. Provide --display=DISPLAY option? How will this work with gnuplot (i.e., how do we know whether gnuplot requires an X display to display graphics)?<br />
<br />
* Implement transparency and lighting in OpenGL backend(s). A basic implementation was available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of octave.<br />
<br />
* Implement a Cairo-based renderer for 2D-only graphics, with support for PS/PDF/SVG output (for printing).<br />
<br />
* On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.<br />
<br />
* Add map-creating capabilities similar to the Matlab [http://www.mathworks.com/help/map/functionlist.html Mapping toolbox] for inclusion in the Octave Forge [https://sourceforge.net/p/octave/mapping mapping package].<br />
<br />
* Add data cursor to trace data values in figure.<br />
<br />
== Lighting ==<br />
<br />
Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.<br />
<br />
== Object selection in OpenGL renderer ==<br />
<br />
This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [http://glprogramming.com/red/chapter13.html]<br />
<br />
== Non-OpenGL renderer ==<br />
<br />
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:<br />
* [http://qt.nokia.com Qt]: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [https://github.com/goffioul/QtHandles]<br />
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.<br />
<br />
== TeX/LaTeX markup ==<br />
<br />
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.<br />
<br />
* 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,<br />
<br />
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre><br />
<br />
:Would be rendered as,<br />
<br />
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup><br />
<br />
:This is analogous to how special characters may be included in a wiki using html.<br />
<br />
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre><br />
<br />
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].<br />
<br />
* 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.<br />
<br />
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html 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 [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.<br />
<br />
=History=<br />
<br />
*Add an option to allow saving input from script files in the history list.<br />
<br />
*The history command should accept two numeric arguments to indicate a range of history entries to display, save or read.<br />
<br />
*Avoid writing the history file if the history list has not changed.<br />
<br />
*Avoid permission errors if the history file cannot be opened for writing.<br />
<br />
*Fix history problems — core dump if multiple processes are writing to the same history file?<br />
<br />
=Configuration and Installation=<br />
<br />
*Makefile changes:<br />
**eliminate for loops<br />
**define shell commands or eliminate them<br />
**consolidate targets<br />
<br />
*Create a docs-only distribution?<br />
<br />
*<strike> Convert build system to a non-recursive Automake setup. See how Makefile.am files currently include module.mk files in subdirectories, extend this concept to the entire project so there is only one top-level Makefile.am. </strike> Done, except for special dir libgnu which is the only SUBDIRS listed in configure.ac.<br />
<br />
=Documentation and On-Line Help=<br />
<br />
*Improve the Texinfo Documentation for the interpreter. It would be useful to have lots more examples, to not have so many forward references, and to not have very many simple lists of functions.<br />
<br />
*[[Doxygen]] documentation for the C++ classes.<br />
<br />
*Make index entries more consistent to improve behavior of <code>help -i</code>.<br />
<br />
*Make <code>help -i</code> try to find a whole word match first.<br />
<br />
*Add more demo files.<br />
<br />
*Flesh out this wiki<br />
<br />
=Tests=<br />
*Improved set of tests: [http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=370633]<br />
**Tests for various functions. Would be nice to have a test file corresponding to every function (see below)<br />
**Tests for element by element operators: + - .* ./ .\ .^ | & < <= == >= > != !<br />
**Tests for boolean operators: && ||<br />
**Tests for other operators: * / \ ' .'<br />
**Tests from bug reports.<br />
**Tests for indexed assignment. Need to consider the following:<br />
***fortran-style indexing<br />
***zero-one indexing<br />
***assignment of empty matrix as well as values resizing<br />
**Tests for all internal functions.<br />
<br />
* Implement a coverage tool for collecting coverage data and generating code coverage reports on m-file functions and scripts. This would be very useful for Octave development as well as for users who want a code coverage report for their own functions and scripts.<br />
<br />
We are far from even having one test for every function, so focus should be on getting the breadth of coverage first before trying to get the depth of 100% statement coverage. As of Dec 2015, 202 of 1020 m-files have no tests. Some of these will be plotting functions which have demos instead, but that leaves enough functions to be an interesting project. As of Dec 2015, there are 485 instances of C++ functions which need tests.<br />
<br />
After Octave is compiled, running the {{Codeline|make check}} build target will run the full test suite and generate a file called test/fntests.log in the build directory with a summary of the results. At the end of the file is a list of all functions for which no tests were found. An extract is posted in the [[files missing tests]] page. If you are not building Octave yourself, the test suite can be run on an installed binary copy by executing the {{Codeline|__run_test_suite__}} command at the Octave prompt. The fntests.log file will be written in the current directory in this case.<br />
<br />
There also need to be tests for functions written in the C++ files. See [[Add_BIST_tests_for_octave_functions_written_in_C%2B%2B]] for instructions and a list of instances.<br />
<br />
See also [[Continuous Build#Coverage Report]].<br />
<br />
=Programming=<br />
<br />
*Better error messages for missing operators?<br />
<br />
*Eliminate duplicate enums in pt-exp.cc, pt-const.cc, and ov.cc.<br />
<br />
*Handle octave_print_internal() stuff at the liboctave level. Then the octave_value classes could just call on the print() methods for the underlying classes.<br />
<br />
*As much as possible, eliminate explicit checks for the types of octave_value objects so that user-defined types will automatically do the right thing in more cases.<br />
<br />
*Only include config.h in files that actually need it, instead of including it in every .cc file. Unfortunately, this might not be so easy to figure out.<br />
<br />
*GNU coding standards:<br />
**Add a `Makefile' target to the Makefiles.<br />
**Comments on #else and #endif preprocessor commands.<br />
**Change error message format to match standards everywhere.<br />
<br />
*Eliminate more global variables.<br />
<br />
*Move procstream to liboctave.<br />
<br />
*Use references and classes in more places.<br />
<br />
*Share more code among the various _options functions.<br />
<br />
*Use non-empty identifiers in all warnings and errors issued by Octave, see [[Easy projects#Miscellaneous]].<br />
<br />
*Reduce the amount of datatypes in liboctave.<br />
<br />
=Miscellaneous=<br />
<br />
*Implement some functions for interprocess communication: bind, accept, connect, gethostbyname, etc. (This functionality is already available in the octave sockets package, what is the purpose of moving it to core octave?)<br />
<br />
*The ability to transparently handle very large files: Juhana K Kouhia <kouhia@nic.funet.fi> wrote:<br />
*: If I have a one-dimensional signal data with the size 400 Mbytes, then what are my choices to operate with it:<br />
*:*I have to split the data<br />
*:*Octave has a virtual memory on its own and I don't have to worry about the splitting.<br />
*:If I split the data, then my easily programmed processing programs will become hard to program.<br />
*:If possible, I would like to have the virtual memory system in Octave i.e., the all big files, the user see as one big array or such. There could be several user selectable models to do the virtual memory depending on what kind of data the user have (1d, 2d) and in what order they are processed (stream or random access).<br />
<br />
*An interface to gdb. Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote:<br />
*:I was thinking about a tool, which could be very useful for me in my numerical simulation work. It is an interconnection between gdb and octave. We are often managing very large arrays of data in our fortran or c codes, which might be studied with the help of octave at the algorithm development stages. Assume you're coding, say, wave equation. And want to debug the code. It would be great to pick some array from the memory of the code you're developing, fft it and see the image as a log-log plot of the spectral density. I'm facing similar problems now. To avoid high c-development cost, I develop in matlab/octave, and then rewrite into c. It might be so much easier, if I could off-load a c array right from the debugger into octave, study it, and, perhaps, change some [many] values with a convenient matlab/octave syntax, similar to <code>a(:,51:250)=zeros(100,200)</code>, and then store it back into the memory of my c code.<br />
<br />
*Implement gdb extensions for Octave types. Octave has the <code>etc/gdbinit</code> file, which has some basic support for displaying the contents of Octave types. Add more extensions to make it easier to debug octave_values and other Octave types.<br />
<br />
*Add a definition to lgrind so that it supports Octave. (See http://www.tex.ac.uk/tex-archive/support/lgrind/ for more information about lgrind.)<br />
<br />
*Spatial statistics, including covariogram estimation and kriging -- perhaps via an interface to [http://www.gstat.org/ gstat]?<br />
<br />
* the [http://octave.sourceforge.net/miscellaneous/function/units.html units] function from the miscellaneous package works by parsing the output of from a call to GNU units. This can be made much more robust by writing it in C++ and including its library "units.h"<br />
<br />
=Marketing and Community=<br />
<br />
* Make the Octave website/[[Project Infrastructure]] easier to maintain.<br />
<br />
* Make it easier for newcomers to contribute.<br />
<br />
* For marketing ideas, see the [https://openoffice.apache.org/orientation/intro-marketing.html Apache Open Office Introduction to Marketing]<br />
<br />
* Help design a user or a [https://www.openoffice.org/marketing/ooocon2006/presentations/wednesday_c10.pdf developer survey]<br />
<br />
* Help prepare and deliver presentations and [[Publications about Octave]] at colleges and universities.<br />
<br />
* Create a [[Forum for GNU Octave]].<br />
<br />
== Improve Windows binary packaging ==<br />
<br />
We are currently able to build and provide a [[Windows Installer|installer for Windows]]. The build process involves cross-compiling on a Linux system using a fork of the [http://mxe.cc/ MXE] project to build Octave and all of its dependencies. Any ideas for improving this process to make it easier or faster, or to improve the installer itself or the installation experience for Windows users would be appreciated.<br />
<br />
'''Skills Required''': Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. No m-scripting or C++ necessary, beyond understanding [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
== Improve macOS binary packaging ==<br />
<br />
We would like to be able to easily generate binary packages for macOS. Right now, it's difficult and tedious to do so. Most OS X users install Octave using one of the source-based package managers such as Homebrew or MacPorts. Any way to help us build a binary package would be appreciated. Required knowledge is understanding how building binaries in macOS works. Our current approach to building binaries for Windows is to cross-compile from a GNU system using [http://mxe.cc/ MXE], something similar may be possible for OS X ([http://lilypond.org/gub/ GUB]?).<br />
<br />
'''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 [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
=Performance=<br />
<br />
*A profiler for Octave would be a very useful tool. And now we have one! But it really needs a better interface.<br />
*Having {{Codeline|parfor}} functioning would speed code development and execution now that multicore architectures are widespread. See [http://octave.1599824.n4.nabble.com/Parfor-td4630575.html here] and [http://stackoverflow.com/questions/24970519/how-to-use-parallel-for-loop-in-octave-or-scilab here]. Existing code from the [[Parallel package | parallel]] and [http://octave.sourceforge.net/mpi/index.html mpi] packages could perhaps be adapted for this.<br />
<br />
=Packaging=<br />
<br />
* create a system that allows packages to deprecate functions as in core. Possibilities are:<br />
** get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated<br />
** PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release<br />
** the package developer can also use something like Make to create a ''normal'' package from something that actually had a more complex structure, inclusive deprecated directories<br />
* get pkg to resolve dependencies automatically by downloading and installing them too<br />
* allow to download and install multiple versions of the same package<br />
* make the package just a bit more verbose by default (specifics?)<br />
* make pkg a little more like apt-get (what specific features of apt-get is this referring to?)<br />
* make pkg support more than one src directory<br />
** subdirectories with makefiles and top level make command of: cd <subdir> && ${MAKE}... ok as a substitute?<br />
* make pkg able to supply extra configure and make flags, useful for distributions, including -j for make (pkg now passes --jobs=N automatically, CFLAGS and CXXFLAGS environment variables are already respected, what's missing?)<br />
<br />
=Preferences=<br />
<br />
Octave has several functions for managing user preferences. Many function use persistent variables instead of relying upon the preference features.<br />
* The function {{Codeline|edit ()}} contains a persistent structure used as its personal set of preferences. These can all be moved to the user preference group for the editor.<br />
** "EDITOR"<br />
** "HOME"<br />
** "AUTHOR"<br />
** "EMAIL"<br />
** "LICENSE"<br />
** "MODE"<br />
** "EDITINPLACE"<br />
* The {{Codeline|savepath ()}} function modifies the startup script (rcfile), {{Codeline|~/.octaverc}} and inserts commands to allow the next session to begin with the same path. Instead user preference can be created for startup items and a preference for the user specified path can be added. Perhaps two path preferences should be used. One for the elements that should precede the core path and those that should follow. A start up directory preference might also be added to allow the user to specify where Octave should begin the next session.<br />
** "PREPATH"<br />
** "POSTPATH"<br />
** "STARTUPDIR"<br />
* A preference group for plotting can also be added. A preference for the default terminal would be useful for those who want to override the default. Preferences for the default {{Codeline|graphicstoolkit}} can also be added.<br />
** GNUPLOTTERM<br />
** GRAPHICSTOOLKIT<br />
* A preference group for printing can include preferences for the default printer, the ghostscript command, and possibly other parameters like orientation, and resolution.<br />
** PRINTER<br />
** GHOSTSCRIPTCOMMAND<br />
** ORIENTATION<br />
** RESOLUTION<br />
* Searching the m-files for use of {{Codeline|persistent}} should turn up other opportunities to use preferences.<br />
<br />
=Bugs=<br />
<br />
There are always bugs to fix. The [https://savannah.gnu.org/bugs/?group=octave bug tracker] is a good place to find tasks needing a hand. See also [[Short projects#Bugs]].<br />
<br />
= Matlab compatibility =<br />
<br />
== Missing functions ==<br />
<br />
There are certain functions present in MATLAB known to be missing in Octave.<br />
<br />
One list is provided on the source for function __unimplemented.m__, subfunction missing_functions; it can be edited in the Octave GUI or browsed at [http://hg.savannah.gnu.org/hgweb/octave/file/default/scripts/help/__unimplemented__.m#l547].<br />
<br />
Lists are also kept for [[:Category:Missing functions|several packages]].<br />
<br />
It is also possible to look at existing [[Wikipedia:Free and open-source software|FOSS]] implementations, from FreeMat and Scilab (for more closely compatible languages) to R or Scipy or Julia (for less compatible versions). Obviously, it is NOT OK to look at the Matlab implementation since this is not [[Wikipedia:Free software|free software]]!<br />
<br />
== Functions under different name ==<br />
<br />
Many Octave Forge functions perform the same as functions from matlab packages. However, they often exist under a different name or have incompatible API's. Often fixing this is a matter of changing their names, swap the order of their input arguments. At least, a list of this functions would be helpful.<br />
<br />
<br />
<br />
[[Category:Development]]<br />
[[Category:Project Ideas]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Projects&diff=12627Projects2020-02-04T09:41:37Z<p>Cdf: /* General purpose Finite Element library */</p>
<hr />
<div>The list below summarizes features or bug fixes we would like to see in Octave. if you start working steadily on a project, please let octave-maintainers@octave.org know. We might have information that could help you. You should also read the [[Contribution guidelines |Contributing Guidelines]].<br />
<br />
This list is not exclusive -- there are many other things that might be good projects, but it might instead be something we already have. Also, some of the following items may not actually be considered good ideas now. So please check with octave-maintainers@octave.org before you start working on some large project.<br />
<br />
Summer of Code students, please also see [[SoC Project Ideas]].<br />
<br />
If you're looking for small project, something more suited to start getting involved with Octave development or to fill a boring evening, see [[short projects]]<br />
<br />
=Numerical=<br />
<br />
* Use C++11 <random> libraries for random number generation. Write link between Octave functions (rand, randi, randn, rande) and C++ API. Implement RandStream objects as Matlab does.<br />
<br />
*Improve logm, and sqrtm (see this thread: http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html)<br />
<br />
*Use pairwise addition in sum() to mitigate against numerical errors without substantial performance penalty (https://en.wikipedia.org/wiki/Pairwise_summation).<br />
<br />
*Review implementing algorithm in this 2009 paper (https://epubs.siam.org/doi/pdf/10.1137/080738490) for xsum (sum with extra accuracy). The existing implementation uses a 2005 paper.<br />
<br />
*Improve complex mapper functions. See W. Kahan, ``Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit (in The State of the Art in Numerical Analysis, eds. Iserles and Powell, Clarendon Press, Oxford, 1987) for explicit trigonometric formulae. See {{patch|8172}} for a previous attempt.<br />
<br />
*Make functions like gamma() return the right IEEE Inf or NaN values for extreme args or other undefined cases.<br />
<br />
*Improve sqp.<br />
<br />
*Fix CollocWt? to handle Laguerre polynomials. Make it easy to extend it to other polynomial types.<br />
<br />
*Add optional arguments to colloc so that it's not restricted to Legendre polynomials.<br />
<br />
*Move rand, eye, xpow, xdiv, etc., functions to the matrix classes.<br />
<br />
*Improve design of ODE, DAE, classes.<br />
<br />
*Make QR more memory efficient for large matrices when not all the columns of Q are required (apparently this is not handled by the lapack code yet).<br />
<br />
*Evaluate harmonics and cross-correlations of unevenly sampled and nonstationary time series, as in http://www.jstatsoft.org/v11/i02 (which has C code with interface to R). (This is now partly implemented in the [http://octave.sourceforge.net/lssa/index.html lssa] package.)<br />
<br />
<!-- == General purpose Finite Element library ==<br />
<br />
Octave-Forge already has a set of packages for discretizing Partial Differential operators by Finite Elements and/or Finite Volumes,<br />
namely the [[bim package]] which relies on the [http://octave.sf.net/msh msh package] (which is in turn based on [http://geuz.org/gmsh/ gmsh]) for creating and managing 2D triangular and 3D tetrahedral meshes and on the [http://octave.sf.net/fpl fpl package] for visualizing 2D results within Octave or exporting 2D or 3D results in a format compatible with [http://www.paraview.org Paraview] or [https://wci.llnl.gov/codes/visit/ 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.<br />
The [http://geopdes.sf.net GeoPDEs] project, on the other hand, offers a complete suite of functions for discretizing a wide range of<br />
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 [http://geopdes.sf.net 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 [http://fenicsproject.org/documentation/ FEniCS] based on the existing C++ or Python interfaces. This second approach has been developed during the GSOC 2013 and the Octave-Forge package [http://octave.sf.net/fem-fenics fem-fenics] is now available. However, fem-fenics could be extended in many different ways:<br />
* implement the bindings for the UFL language inside Octave<br />
* add new functions already available with Fenics but not yet in Octave<br />
* create new functions specifically suited for Octave<br />
* improve the efficiency of the code<br />
The main goal for the fem-fenics package is ultimately to be merged with the FEnics project itself, so that it can remain in-sync with the main library development. --><br />
<br />
== Implement solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D ==<br />
<br />
The project will deliver a solver for initial-boundary value problems for parabolic-elliptic PDEs in 1D similar to Matlab's function <tt>pdepe</tt>. A good starting point is the [http://en.wikipedia.org/wiki/Method_of_lines method of lines] for which you can find more details [http://en.wikibooks.org/wiki/Partial_Differential_Equations/Method_of_Lines here] and [http://www.scholarpedia.org/article/Method_of_lines here], whereas an example implementation can be found [http://www.scholarpedia.org/article/Method_of_Lines/Example_Implementation here]. In addition, [http://www.pdecomp.net/ this page] provides some useful material.<br />
<br />
== Implement solver for 1D nonlinear boundary value problems ==<br />
<br />
The project will complete the implementation of the bvp4c solver that is already available in an initial version in the odepkg package<br />
by adding a proper error estimator and will implement a matlab-compatible version of the bvp5c solver.<br />
Details on the methods to be implemented can be found in [http://dx.doi.org/10.1145/502800.502801 this paper] on bvp4c and [http://www.jnaiam.net/new/uploads/files/014dde86eef73328e7ab674d1a32aa9c.pdf this paper] on bvp5c. Further details are available in [http://books.google.it/books/about/Nonlinear_two_point_boundary_value_probl.html?id=s_pQAAAAMAAJ&redir_esc=y this book].<br />
<br />
== Geometric integrators for Hamiltonian Systems ==<br />
<br />
[http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration Geometric (AKA Symplectic) integrators] are useful for <br />
multi-dimensional classical mechanics problems and for molecular dynamics simulations.<br />
The odepkg package has a number of solvers for ODE, DAE and DDE problems but none of them is currently<br />
specifically suited for second order problems in general and Hamiltonian systems in particular.<br />
Therefore a new package for geometric integrators would be a useful contribution.<br />
This could be created as new package or added as a set of new functions for odepkg.<br />
The function interface should be consistent throughout the package and should be modeled to follow <br />
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.<br />
An initial list of methods to be implemented includes (but is not limited to)<br />
* Symplectic Euler methods, see [http://en.wikipedia.org/wiki/Semi-implicit_Euler_method here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Störmer-Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Velocity Verlet method, see [http://en.wikipedia.org/wiki/Verlet_integration here] and [http://openlibrary.org/books/OL9056139M/Geometric_Numerical_Integration here]<br />
* Symplectic partitioned Runge-Kutta methods, see [http://reference.wolfram.com/mathematica/tutorial/NDSolveSPRK.html here] or [http://dx.doi.org/10.1137/0733019 here]<br />
* Spectral Variational Integrator methods, see [http://www3.nd.edu/~izaguirr/papers/acta_numerica.pdf here] or [http://www.math.ucsd.edu/~mleok/pdf/HaLe2012_SVI.pdf here]<br />
<br />
For this latter there is an existing code which is already working but needs to be improved, posted on the patch tracker.<br />
Furthermore, methods to implement solutions of problems with rigid constraints should be implemented, e.g.<br />
* SHAKE, see [http://en.wikipedia.org/wiki/Constraint_algorithm here] or [http://dx.doi.org/10.1016/0021-9991(77)90098-5 here]<br />
* RATTLE, see [http://dx.doi.org/10.1016/0021-9991(83)90014-1 here] or [http://dx.doi.org/10.1002/jcc.540161003 here]<br />
<br />
== Matlab-compatible ODE solvers in core-Octave ==<br />
<br />
* <strike> 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. </strike><br />
* <strike> Adapt the interface of "ode45" in odepkg to be completely Matlab compatible, fix its code and documentation style and move it to Octave-core. </strike><br />
* <strike> Build Matlab compatible versions of "ode15s" and "ode15i". jwe has prototype implementations [https://savannah.gnu.org/patch/?8102 here] 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. </strike><br />
* Implement Matlab compatible versions of "deval".<br />
<br />
== High Precision Arithmetic Computation ==<br />
<br />
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-conditioned. 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<br />
<br />
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.<br />
<br />
=GUI/IDE=<br />
<br />
*Søren Hauberg has suggested that we need C++ code that can:<br />
**Determine if a line of code could be fully parsed, i.e. it would return true for "plot (x, y);", but false for "while (true)".<br />
**Evaluate a line of code and return the output as a string (it would be best if it could provide three strings: output, warnings and errors).<br />
**Query defined variables, i.e. get a list of currently defined variables. Bonus points if it could tell you if anything had changed since the last time you checked the variables (could also be done with signals).<br />
* Create a better (G)UI for the {{manual|profile|profiler}}. This may be done with Qt, but not necessarily.<br />
<br />
== GUI Variable Editor and Property Inspector ==<br />
<br />
Octave has a preliminary implementation of a Variable Editor: a spreadsheet-like tool for quickly editing and visualizing variables. The initial phase of the project will be learning how the implementation was done.<br />
<br />
With the knowledge gained, the second part of the project will be to implement a Property Inspector. This is a spreadsheet like interface to the many, many graphics properties that exist and are different on a per-object basis. The goal would be not only the concise-display of the existing properties, but a reasonable user interface to change them. As examples, Boolean properties should be able to be toggled with a double-click; Radio properties should have a drop-down list of only the supported options; Other properties that can be modified should have the constraints built-in (for example, Linewidth must be a scalar, while Position must be a 1x4 vector). It would also be important to have easy access to the documentation of a property.<br />
<br />
For reference, Matlab has a similar Property Inspector (https://www.mathworks.com/help/matlab/ref/inspect.html).<br />
<br />
== Sisotool. Create a graphical design tool for tuning closed loop control system ([[Control package]])==<br />
<br />
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.<br />
Recently, some implementation was done during [[Summer_of_Code#GSoC_2018|GSoC 2018]], see https://eriveltongualter.github.io/GSoC2018/final.html for details.<br />
<br />
=Sparse Matrices=<br />
<br />
The paper by [http://arxiv.org/abs/cs.MS/0604006 Bateman & Adler] is good reading for understanding the sparse matrix implementation.<br />
<br />
*Improve Matlab compatibility for {{manual|sprandsym}}.<br />
<br />
*Sparse logical indexing in idx_vector class so that something like <code>a = sprandn (1e6, 1e6, 1e-6); a(a<1) = 0;</code> won't cause a memory overflow.<br />
<br />
*Other missing Functions<br />
**lsqr<br />
**minres<br />
**symmlq<br />
<br />
== SPQR Interface ==<br />
<br />
Octave implements QR factorization for sparse matrices, but it does so with an older "CXSPARSE" library. This has caused fundamental issues, including segfaults as recorded here (bugs {{bug|51950}} and {{bug|57033}}). The goal of this project is to program an interface to the API for the SQPR library (http://faculty.cse.tamu.edu/davis/suitesparse.html). This is the same library that Matlab uses for this purpose.<br />
<br />
*Improve QR factorization functions, using idea based on CSPARSE cs_dmsol.m<br />
<br />
*Improve QR factorization by replacing CXSPARSE code with SPQR code, and make the linear solve return 2-norm solutions for ill-conditioned matrices based on this new code<br />
<br />
=Strings=<br />
<br />
*Consider making octave_print_internal() print some sort of text representation for unprintable characters instead of sending them directly to the terminal. (But don't do this for fprintf!)<br />
<br />
*Consider changing the default value of `string_fill_char' from SPC to NUL.<br />
<br />
=Other Data Types=<br />
<br />
*Template functions for mixed-type ops.<br />
<br />
*Convert other functions for use with the floating point type including quad, dasrt, daspk, etc.<br />
<br />
=Input/Output=<br />
<br />
*Make fread and fwrite work for complex data. Iostreams based versions of these functions would also be nice, and if you are working on them, it would be good to support other size specifications (integer*2, etc.).<br />
<br />
*Move some pr-output stuff to liboctave.<br />
<br />
*Make the cutoff point for changing to packed storage a user-preference variable with default value 8192.<br />
<br />
*Complain if there is not enough disk space available (I think there is simply not enough error checking in the code that handles writing data).<br />
<br />
*Make it possible to tie arbitrary input and output streams together, similar to the way iostreams can be tied together.<br />
<br />
*Expand {{codeline|imwrite}} options. This shouldn't be too hard to implement, since it's wrapped around GraphicsMagick.<br />
<br />
*Extend Octave functions to work on stored arrays that are too big to fit in RAM, similar to available R [http://www.bigmemory.org/ packages.]<br />
<br />
* write {{codeline|xmlread}} and {{codeline|xmlwrite}}. This could be done using [http://xerces.apache.org/xerces-c/ Xerces C++ interface] which apparently is what [http://octave.1599824.n4.nabble.com/xml-in-octave-td4663034.html Matlab uses].<br />
<br />
* Implement hdf5 for .mat files (see [http://octave.1599824.n4.nabble.com/Reading-Matlab-td4650158.html this thread]).<br />
<br />
=Interpreter=<br />
<br />
The interpreter is written in C++, undocumented. There are many possible projects associated with it.<br />
<br />
'''Required skills''': ''Very good'' C and C++ knowledge, possibly also understanding of [http://en.wikipedia.org/wiki/Gnu_bison GNU bison] and [http://en.wikipedia.org/wiki/Flex_lexical_analyser 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.<br />
<br />
*Allow customization of the debug prompt.<br />
<br />
*Fix the parser so that<br />
<br />
if (expr) 'this is a string' end<br />
<br />
is parsed as IF expr STRING END. ''(see [https://lists.gnu.org/archive/html/octave-maintainers/2014-03/msg00087.html this] post on the mailing list)''<br />
<br />
*Clean up functions in input.cc that handle user input (there currently seems to be some unnecessary duplication of code and it seems overly complex).<br />
<br />
*Consider allowing an arbitrary property list to be attached to any variable. This could be a more general way to handle the help string that can currently be added with `document'.<br />
<br />
*Allow more command line options to be accessible as built-in variables (--echo-commands, etc.).<br />
<br />
*Make the interpreter run faster.<br />
<br />
*Allow arbitrary lower bounds for array indexing.<br />
<br />
*Improve performance of recursive function calls.<br />
<br />
*Improve the way ignore_function_time_stamp works to allow selecting by individual directories or functions.<br />
<br />
*Add a command-line option to tell Octave to just do syntax checking and not execute statements.<br />
<br />
*Clean up symtab and variable stuff.<br />
<br />
*Input stream class for parser files -- must manage buffers for flex and context for global variable settings.<br />
<br />
*make parser do more semantic checking, continue after errors when compiling functions, etc.<br />
<br />
*Make LEXICAL_ERROR have a value that is the error message for parse_error() to print?<br />
<br />
*Add a run-time alias mechanism that would allow things like alias fun function_with_a_very_long_name so that `function_with_a_very_long_name' could be invoked as `fun'.<br />
<br />
*Allow local changes to variables to be written more compactly than is currently possible with unwind_protect. For example, <br />
<br />
function f ()<br />
local prefer_column_vectors = something;<br />
...<br />
endfunction<br />
<br />
<br />
would be equivalent to<br />
<br />
function f ()<br />
save_prefer_column_vectors = prefer_column_vectors;<br />
unwind_protect<br />
prefer_column_vectors = something;<br />
...<br />
unwind_protect_cleanup<br />
prefer_column_vectors = save_prefer_column_vectors;<br />
end_unwind_protect<br />
endfunction<br />
<br />
<br />
*Fix all function files to check for bogus inputs (wrong number or types of input arguments, wrong number of output arguments).<br />
<br />
*Handle options for built-in functions more consistently.<br />
<br />
*Too much time is spent allocating and freeing memory. What can be done to improve performance?<br />
<br />
Use move constructors rather than copy constructors for things like dim_vectors which are repeatedly created just to initialize Array or Matrix objects.<br />
<br />
*Error output from Fortran code is ugly. Something should be done to make it look better.<br />
<br />
*It would be nice if output from the Fortran routines could be passed through the pager.<br />
<br />
*Attempt to recognize common subexpressions in the parser.<br />
<br />
*Consider making it possible to specify an empty matrix with a syntax like [](e1, e2). Of course at least one of the expressions must be zero...<br />
<br />
*Is Matrix::fortran_vec() really necessary?<br />
<br />
*Rewrite whos and the symbol_record_info class. Write a built-in function that gives all the basic information, then write who and whos as M-files.<br />
<br />
*On systems that support matherr(), make it possible for users to enable the printing of warning messages.<br />
<br />
*Make it possible to mark variables and functions as read-only.<br />
<br />
*Make it possible to write a function that gets a reference to a matrix in memory and change one or more elements without generating a second copy of the data.<br />
<br />
*Use nanosleep instead of usleep if it is available? Apparently nanosleep is to be preferred over usleep on Solaris systems.<br />
<br />
*<strike>Per the following discussion, allow bsxfun style singleton dimension expansion as the default behavior for the builtin element-wise operators: http://octave.1599824.n4.nabble.com/Vector-approach-to-row-margin-frequencies-tp1636361p1636367.html</strike> This is done. <strike>Now [[User:JordiGH|I]] just have to document it.</strike> This is done too!<br />
<br />
== Improve JIT compiling ==<br />
<br />
Octave's interpreter is ''very'' slow on some loops. Recently, thanks to Max Brister's work, an initial implementation of a just-in-time compiler (JITC) in [http://llvm.org 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. [http://planet.octave.org/octconf2012/jit.pdf Here] is Max's OctConf 2012 presentation about his current implementation. See also [[JIT]].<br />
<br />
== Improve memory management ==<br />
<br />
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.<br />
<br />
== Implement classdef classes ==<br />
<br />
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 classdef classes in version 4.0, refer to the [[Classdef|classdef status page]] for what is not yet implemented. There is irregular work here, and classdef is [http://www.mathworks.com/help/matlab/matlab_oop/method-attributes.html a very] [http://www.mathworks.com/help/matlab/events-sending-and-responding-to-messages.html complicated] [http://www.mathworks.com/help/matlab/enumeration-classes.html 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.<br />
<br />
Although there's already a substantial classdef support in current octave code base, there are still many areas that are unimplemented or need improvements. The main ones that come to my mind are:<br />
* support for events<br />
* support for enums<br />
* support for "import" (this requires good understanding of octave internals, especially the symbol table)<br />
* improving multiple inheritance and method resolution<br />
* honoring and computing "Sealed" attribute<br />
* support for function handle to methods<br />
<br />
== Improve MPI package ==<br />
<br />
Octave Forge's [http://octave.sourceforge.net/mpi/index.html MPI package] <br />
is a wrapper for basic MPI functions for parallel computing. It is implemented <br />
by wrapping MPI function calls in simple DLD functions that map Octave's Datataypes to <br />
MPI Derived Datatypes. <br />
The proposed project deals with improving and extending the Octave MPI package, for example:<br />
* Octave MPI applications can currently be only run in batch mode, add the ability to launch parallel jobs and collect their output in an interactive Octave session.<br />
* Implement functions for non-blocking communication (MPI_Isend, MPI_Irecv)<br />
* Implement one-to-many (Broadcast, Scatter), many-to-one (Reduce, Gather), and many-to-many (All Reduce, Allgather) communication routines<br />
<br />
=Graphics=<br />
<br />
*Correctly handle case where DISPLAY is unset. Provide --no-window-system or --nodisplay (?) option. Provide --display=DISPLAY option? How will this work with gnuplot (i.e., how do we know whether gnuplot requires an X display to display graphics)?<br />
<br />
* Implement transparency and lighting in OpenGL backend(s). A basic implementation was available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of octave.<br />
<br />
* Implement a Cairo-based renderer for 2D-only graphics, with support for PS/PDF/SVG output (for printing).<br />
<br />
* On 'imagesc' plots, report the matrix values also based on the mouse position, updating on mouse moving.<br />
<br />
* Add map-creating capabilities similar to the Matlab [http://www.mathworks.com/help/map/functionlist.html Mapping toolbox] for inclusion in the Octave Forge [https://sourceforge.net/p/octave/mapping mapping package].<br />
<br />
* Add data cursor to trace data values in figure.<br />
<br />
== Lighting ==<br />
<br />
Implement transparency and lighting in OpenGL backend(s). A basic implementation is available in [http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/jhandles/ JHandles]. This needs to be ported/re-implement/re-engineered/optimized in the C++ OpenGL renderer of Octave.<br />
<br />
== Object selection in OpenGL renderer ==<br />
<br />
This project is about the implementation of a selection method of graphics elements within the OpenGL renderer [http://glprogramming.com/red/chapter13.html]<br />
<br />
== Non-OpenGL renderer ==<br />
<br />
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:<br />
* [http://qt.nokia.com Qt]: the GUI is currently written in Qt and work is also in progress to provide a Qt/OpenGL based backend [https://github.com/goffioul/QtHandles]<br />
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.<br />
<br />
== TeX/LaTeX markup ==<br />
<br />
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.<br />
<br />
* 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,<br />
<br />
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre><br />
<br />
:Would be rendered as,<br />
<br />
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup><br />
<br />
:This is analogous to how special characters may be included in a wiki using html.<br />
<br />
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre><br />
<br />
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].<br />
<br />
* 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.<br />
<br />
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html 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 [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.<br />
<br />
=History=<br />
<br />
*Add an option to allow saving input from script files in the history list.<br />
<br />
*The history command should accept two numeric arguments to indicate a range of history entries to display, save or read.<br />
<br />
*Avoid writing the history file if the history list has not changed.<br />
<br />
*Avoid permission errors if the history file cannot be opened for writing.<br />
<br />
*Fix history problems — core dump if multiple processes are writing to the same history file?<br />
<br />
=Configuration and Installation=<br />
<br />
*Makefile changes:<br />
**eliminate for loops<br />
**define shell commands or eliminate them<br />
**consolidate targets<br />
<br />
*Create a docs-only distribution?<br />
<br />
*<strike> Convert build system to a non-recursive Automake setup. See how Makefile.am files currently include module.mk files in subdirectories, extend this concept to the entire project so there is only one top-level Makefile.am. </strike> Done, except for special dir libgnu which is the only SUBDIRS listed in configure.ac.<br />
<br />
=Documentation and On-Line Help=<br />
<br />
*Improve the Texinfo Documentation for the interpreter. It would be useful to have lots more examples, to not have so many forward references, and to not have very many simple lists of functions.<br />
<br />
*[[Doxygen]] documentation for the C++ classes.<br />
<br />
*Make index entries more consistent to improve behavior of <code>help -i</code>.<br />
<br />
*Make <code>help -i</code> try to find a whole word match first.<br />
<br />
*Add more demo files.<br />
<br />
*Flesh out this wiki<br />
<br />
=Tests=<br />
*Improved set of tests: [http://octave.1599824.n4.nabble.com/template/NamlServlet.jtp?macro=user_nodes&user=370633]<br />
**Tests for various functions. Would be nice to have a test file corresponding to every function (see below)<br />
**Tests for element by element operators: + - .* ./ .\ .^ | & < <= == >= > != !<br />
**Tests for boolean operators: && ||<br />
**Tests for other operators: * / \ ' .'<br />
**Tests from bug reports.<br />
**Tests for indexed assignment. Need to consider the following:<br />
***fortran-style indexing<br />
***zero-one indexing<br />
***assignment of empty matrix as well as values resizing<br />
**Tests for all internal functions.<br />
<br />
* Implement a coverage tool for collecting coverage data and generating code coverage reports on m-file functions and scripts. This would be very useful for Octave development as well as for users who want a code coverage report for their own functions and scripts.<br />
<br />
We are far from even having one test for every function, so focus should be on getting the breadth of coverage first before trying to get the depth of 100% statement coverage. As of Dec 2015, 202 of 1020 m-files have no tests. Some of these will be plotting functions which have demos instead, but that leaves enough functions to be an interesting project. As of Dec 2015, there are 485 instances of C++ functions which need tests.<br />
<br />
After Octave is compiled, running the {{Codeline|make check}} build target will run the full test suite and generate a file called test/fntests.log in the build directory with a summary of the results. At the end of the file is a list of all functions for which no tests were found. An extract is posted in the [[files missing tests]] page. If you are not building Octave yourself, the test suite can be run on an installed binary copy by executing the {{Codeline|__run_test_suite__}} command at the Octave prompt. The fntests.log file will be written in the current directory in this case.<br />
<br />
There also need to be tests for functions written in the C++ files. See [[Add_BIST_tests_for_octave_functions_written_in_C%2B%2B]] for instructions and a list of instances.<br />
<br />
See also [[Continuous Build#Coverage Report]].<br />
<br />
=Programming=<br />
<br />
*Better error messages for missing operators?<br />
<br />
*Eliminate duplicate enums in pt-exp.cc, pt-const.cc, and ov.cc.<br />
<br />
*Handle octave_print_internal() stuff at the liboctave level. Then the octave_value classes could just call on the print() methods for the underlying classes.<br />
<br />
*As much as possible, eliminate explicit checks for the types of octave_value objects so that user-defined types will automatically do the right thing in more cases.<br />
<br />
*Only include config.h in files that actually need it, instead of including it in every .cc file. Unfortunately, this might not be so easy to figure out.<br />
<br />
*GNU coding standards:<br />
**Add a `Makefile' target to the Makefiles.<br />
**Comments on #else and #endif preprocessor commands.<br />
**Change error message format to match standards everywhere.<br />
<br />
*Eliminate more global variables.<br />
<br />
*Move procstream to liboctave.<br />
<br />
*Use references and classes in more places.<br />
<br />
*Share more code among the various _options functions.<br />
<br />
*Use non-empty identifiers in all warnings and errors issued by Octave, see [[Easy projects#Miscellaneous]].<br />
<br />
*Reduce the amount of datatypes in liboctave.<br />
<br />
=Miscellaneous=<br />
<br />
*Implement some functions for interprocess communication: bind, accept, connect, gethostbyname, etc. (This functionality is already available in the octave sockets package, what is the purpose of moving it to core octave?)<br />
<br />
*The ability to transparently handle very large files: Juhana K Kouhia <kouhia@nic.funet.fi> wrote:<br />
*: If I have a one-dimensional signal data with the size 400 Mbytes, then what are my choices to operate with it:<br />
*:*I have to split the data<br />
*:*Octave has a virtual memory on its own and I don't have to worry about the splitting.<br />
*:If I split the data, then my easily programmed processing programs will become hard to program.<br />
*:If possible, I would like to have the virtual memory system in Octave i.e., the all big files, the user see as one big array or such. There could be several user selectable models to do the virtual memory depending on what kind of data the user have (1d, 2d) and in what order they are processed (stream or random access).<br />
<br />
*An interface to gdb. Michael Smolsky <fnsiguc@weizmann.weizmann.ac.il> wrote:<br />
*:I was thinking about a tool, which could be very useful for me in my numerical simulation work. It is an interconnection between gdb and octave. We are often managing very large arrays of data in our fortran or c codes, which might be studied with the help of octave at the algorithm development stages. Assume you're coding, say, wave equation. And want to debug the code. It would be great to pick some array from the memory of the code you're developing, fft it and see the image as a log-log plot of the spectral density. I'm facing similar problems now. To avoid high c-development cost, I develop in matlab/octave, and then rewrite into c. It might be so much easier, if I could off-load a c array right from the debugger into octave, study it, and, perhaps, change some [many] values with a convenient matlab/octave syntax, similar to <code>a(:,51:250)=zeros(100,200)</code>, and then store it back into the memory of my c code.<br />
<br />
*Implement gdb extensions for Octave types. Octave has the <code>etc/gdbinit</code> file, which has some basic support for displaying the contents of Octave types. Add more extensions to make it easier to debug octave_values and other Octave types.<br />
<br />
*Add a definition to lgrind so that it supports Octave. (See http://www.tex.ac.uk/tex-archive/support/lgrind/ for more information about lgrind.)<br />
<br />
*Spatial statistics, including covariogram estimation and kriging -- perhaps via an interface to [http://www.gstat.org/ gstat]?<br />
<br />
* the [http://octave.sourceforge.net/miscellaneous/function/units.html units] function from the miscellaneous package works by parsing the output of from a call to GNU units. This can be made much more robust by writing it in C++ and including its library "units.h"<br />
<br />
=Marketing and Community=<br />
<br />
* Make the Octave website/[[Project Infrastructure]] easier to maintain.<br />
<br />
* Make it easier for newcomers to contribute.<br />
<br />
* For marketing ideas, see the [https://openoffice.apache.org/orientation/intro-marketing.html Apache Open Office Introduction to Marketing]<br />
<br />
* Help design a user or a [https://www.openoffice.org/marketing/ooocon2006/presentations/wednesday_c10.pdf developer survey]<br />
<br />
* Help prepare and deliver presentations and [[Publications about Octave]] at colleges and universities.<br />
<br />
* Create a [[Forum for GNU Octave]].<br />
<br />
== Improve Windows binary packaging ==<br />
<br />
We are currently able to build and provide a [[Windows Installer|installer for Windows]]. The build process involves cross-compiling on a Linux system using a fork of the [http://mxe.cc/ MXE] project to build Octave and all of its dependencies. Any ideas for improving this process to make it easier or faster, or to improve the installer itself or the installation experience for Windows users would be appreciated.<br />
<br />
'''Skills Required''': Knowledge of GNU build systems, Makefiles, configure files, chasing library dependencies, how to use a compiler. No m-scripting or C++ necessary, beyond understanding [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
== Improve macOS binary packaging ==<br />
<br />
We would like to be able to easily generate binary packages for macOS. Right now, it's difficult and tedious to do so. Most OS X users install Octave using one of the source-based package managers such as Homebrew or MacPorts. Any way to help us build a binary package would be appreciated. Required knowledge is understanding how building binaries in macOS works. Our current approach to building binaries for Windows is to cross-compile from a GNU system using [http://mxe.cc/ MXE], something similar may be possible for OS X ([http://lilypond.org/gub/ GUB]?).<br />
<br />
'''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 [http://david.rothlis.net/c/compilation_model/ the C++ compilation model].<br />
<br />
=Performance=<br />
<br />
*A profiler for Octave would be a very useful tool. And now we have one! But it really needs a better interface.<br />
*Having {{Codeline|parfor}} functioning would speed code development and execution now that multicore architectures are widespread. See [http://octave.1599824.n4.nabble.com/Parfor-td4630575.html here] and [http://stackoverflow.com/questions/24970519/how-to-use-parallel-for-loop-in-octave-or-scilab here]. Existing code from the [[Parallel package | parallel]] and [http://octave.sourceforge.net/mpi/index.html mpi] packages could perhaps be adapted for this.<br />
<br />
=Packaging=<br />
<br />
* create a system that allows packages to deprecate functions as in core. Possibilities are:<br />
** get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated<br />
** PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release<br />
** the package developer can also use something like Make to create a ''normal'' package from something that actually had a more complex structure, inclusive deprecated directories<br />
* get pkg to resolve dependencies automatically by downloading and installing them too<br />
* allow to download and install multiple versions of the same package<br />
* make the package just a bit more verbose by default (specifics?)<br />
* make pkg a little more like apt-get (what specific features of apt-get is this referring to?)<br />
* make pkg support more than one src directory<br />
** subdirectories with makefiles and top level make command of: cd <subdir> && ${MAKE}... ok as a substitute?<br />
* make pkg able to supply extra configure and make flags, useful for distributions, including -j for make (pkg now passes --jobs=N automatically, CFLAGS and CXXFLAGS environment variables are already respected, what's missing?)<br />
<br />
=Preferences=<br />
<br />
Octave has several functions for managing user preferences. Many function use persistent variables instead of relying upon the preference features.<br />
* The function {{Codeline|edit ()}} contains a persistent structure used as its personal set of preferences. These can all be moved to the user preference group for the editor.<br />
** "EDITOR"<br />
** "HOME"<br />
** "AUTHOR"<br />
** "EMAIL"<br />
** "LICENSE"<br />
** "MODE"<br />
** "EDITINPLACE"<br />
* The {{Codeline|savepath ()}} function modifies the startup script (rcfile), {{Codeline|~/.octaverc}} and inserts commands to allow the next session to begin with the same path. Instead user preference can be created for startup items and a preference for the user specified path can be added. Perhaps two path preferences should be used. One for the elements that should precede the core path and those that should follow. A start up directory preference might also be added to allow the user to specify where Octave should begin the next session.<br />
** "PREPATH"<br />
** "POSTPATH"<br />
** "STARTUPDIR"<br />
* A preference group for plotting can also be added. A preference for the default terminal would be useful for those who want to override the default. Preferences for the default {{Codeline|graphicstoolkit}} can also be added.<br />
** GNUPLOTTERM<br />
** GRAPHICSTOOLKIT<br />
* A preference group for printing can include preferences for the default printer, the ghostscript command, and possibly other parameters like orientation, and resolution.<br />
** PRINTER<br />
** GHOSTSCRIPTCOMMAND<br />
** ORIENTATION<br />
** RESOLUTION<br />
* Searching the m-files for use of {{Codeline|persistent}} should turn up other opportunities to use preferences.<br />
<br />
=Bugs=<br />
<br />
There are always bugs to fix. The [https://savannah.gnu.org/bugs/?group=octave bug tracker] is a good place to find tasks needing a hand. See also [[Short projects#Bugs]].<br />
<br />
= Matlab compatibility =<br />
<br />
== Missing functions ==<br />
<br />
There are certain functions present in MATLAB known to be missing in Octave.<br />
<br />
One list is provided on the source for function __unimplemented.m__, subfunction missing_functions; it can be edited in the Octave GUI or browsed at [http://hg.savannah.gnu.org/hgweb/octave/file/default/scripts/help/__unimplemented__.m#l547].<br />
<br />
Lists are also kept for [[:Category:Missing functions|several packages]].<br />
<br />
It is also possible to look at existing [[Wikipedia:Free and open-source software|FOSS]] implementations, from FreeMat and Scilab (for more closely compatible languages) to R or Scipy or Julia (for less compatible versions). Obviously, it is NOT OK to look at the Matlab implementation since this is not [[Wikipedia:Free software|free software]]!<br />
<br />
== Functions under different name ==<br />
<br />
Many Octave Forge functions perform the same as functions from matlab packages. However, they often exist under a different name or have incompatible API's. Often fixing this is a matter of changing their names, swap the order of their input arguments. At least, a list of this functions would be helpful.<br />
<br />
<br />
<br />
[[Category:Development]]<br />
[[Category:Project Ideas]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=11926Ocs package2019-05-29T11:21:03Z<p>Cdf: /* Creating a model for a memristor device */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
<br />
OCS was developed during the CoMSON (Coupled Multiscale Simulation and Optimization) project which involved several universities but also several industrial partners.<br />
<br />
Each of the industrial partners at the time was using its own circuit simulation software and each software had different file formats for circuit netlists.<br />
<br />
Given the purposes of the project and the composition of the consortium the main design objectives for OCS where<br />
<br />
* provide a format for "element evaluators" independent of time-stepping algorithms<br />
* provide a "hierarchical" data structure where elements could be composed themselves of lumped-element networks<br />
* allow coupling of lumped-element networks (0D) and 1D/2D/3D device models<br />
* use an intermediate/interchange file format so that none of the formats in use by the industrial partners would be favoured over the others<br />
* be written in an interpreted language for quick prototyping and easy maintainance<br />
* be Free Software<br />
<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|OCS structure format |<syntaxhighlight lang="octave" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , pvmatrix(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
=== A circuit with a linear VCVS ===<br />
<br />
To parse an IFF format netlist of the VCVS circuit we can use the following command<br />
<br />
{{Code|Load the VCVS circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("vcvs");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "vcvs.cir" shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
%0.1b1<br />
% A Simple linear VCVS example<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
1 4<br />
Ampl f delay shift<br />
1 1 0.0 0.0<br />
1 0 <br />
END<br />
% VCVS<br />
Mvcvs LIN 4 1<br />
1 1<br />
Gain<br />
5.0<br />
2 0 1 0<br />
% Resistor<br />
Mresistors LIN 2 1<br />
1 1<br />
R<br />
1<br />
1 2<br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 V_controller<br />
2 V_controlled<br />
</syntaxhighlight><br />
}}<br />
<br />
The implementation for the VCVS with linear gain is shown below<br />
<br />
{{Code|Model evaluator file for simple VCVS model |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mvcvs (string, parameters, parameternames, extvar,<br />
intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
##LCR part<br />
case "LIN"<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
j = intvar (1);<br />
Vin = extvar (3) - extvar (4);<br />
V = Vin * Gain;<br />
<br />
a = zeros (5); <br />
b = [0 0 0 0 1;<br />
0 0 0 0 -1;<br />
0 0 0 0 0;<br />
0 0 0 0 0;<br />
1 -1 -Gain Gain 0];<br />
<br />
c = [0 0 0 0 0];<br />
break<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:VCVS_result.png|thumb| Result of the VCVS simulation]]<br />
<br />
To run a simulation with this circuit use the following commands:<br />
<br />
{{Code|Run a simple transient simulation with the VCVS circuit |<syntaxhighlight lang="octave" style="font-size:13px"><br />
>> x = [0 0 0 0]';<br />
>> t = linspace(0,1,50);<br />
>> [out, niter] = tst_backward_euler (outstruct, x, t, 1e-6, 100, pltvars, [0 1]);<br />
</syntaxhighlight><br />
}}<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al.: <br />
<br />
Carbajal, J. P. et al. <br />
[http://www.mitpressjournals.org/doi/abs/10.1162/NECO_a_00694?journalCode=neco#.VgFNn9tSukp Memristor models for machine learning]. <br />
Neural Computation, 27(3), 2015. <br />
doi:10.1162/NECO_a_00694<br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.<br />
<br />
[[Category:Octave Forge]][[Category:Packages]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2018&diff=10553OctConf 20182017-12-01T15:32:23Z<p>Cdf: /* Schedule */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2018 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 12th until March 15th. <br />
<br />
The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: <br />
* Octave is a fundamental tool of analysis and research for hundreds of CERN scientists<br />
* Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The two-day plus two-half-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond.<br />
<br />
Our [[OctConf_2018#Scientific_committee | scientific committee]] is working out the details of the programme, which will include: a presentation by Octave's creator and main maintainer John W. Eaton in the CERN Main Auditorium (Monday afternoon), several interesting talks about applications of Octave to various scientific domains, code sprints, and a session to promote the open-source supported by public institutions as a model for free and successful development. The call for contributions and abstract will be open soon.<br />
<br />
The key members of the Octave development team will participate in the conference, both from oversea and from Europe. You can find updated information on the programme in this Wiki page and we are filling the [https://indico.cern.ch/event/626097/ Indico] timetable.<br />
<br />
== Dates ==<br />
<br />
The conference will take place on Week 11, from March 12th until March 15th 2018.<br />
<br />
'''Duration''': 1/2 + 2 + 1/2 days (requires >=4 days break from work)<br />
<br />
== Committees ==<br />
=== Scientific committee ===<br />
'''Duties''': Recruit invited speakers, finalize the programme schedule, review and select presentations, review and select posters, chairing during conference. <br />
<br />
'''Members''':<br />
<br />
* [[User:Carandraug|Carnë Draug]]<br />
* Carlo de Falco<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* Rafael Vázquez<br />
<br />
<br />
Use the [mailto:maintainers@octave.org maintainers mailing list] to communicate with these people.<br />
<br />
=== Hosting committtee ===<br />
'''Duties''': Arrange and reserve rooms, catering, social event, and other logistics for the conference.<br />
<br />
'''Members''':<br />
<br />
* Andrea Latina<br />
* John Evans<br />
* Melissa Gaillard<br />
<br />
== Location ==<br />
The upcoming Octconf 2018 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
TBA<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday 12.03<br/>(Opening)</th><br />
<th width="220">Tuesday 13.03<br/>(Tutorials)</th><br />
<th width="250">Wednesday 14.03<br/>(Unconference)</th><br />
<th width="220">Thursday 15.03<br/>(Closing)</th><br />
</tr><br />
<tr><br />
<td><br/><br/>Morning<br/><br/></td><br />
<td bgcolor= #ffb3b3></td><br />
<td> Unconference </td><br />
<td> Unconference </td><br />
<td> Closing and OctConf 2019 planning </td><br />
</tr><br />
<tr><br />
<td><br/><br/>Noon<br/><br/> </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Farewell lunch</td><br />
</tr><br />
<tr><br />
<td rowspan=2><br/><br/>Afternoon<br/><br/></td><br />
<td> Unconference </td><br />
<td rowspan=2> Hands on Tutorials </td><br />
<td rowspan=2> Visit to CERN </td><br />
<td bgcolor=#ffb3b3 rowspan=3></td><br />
</tr><br />
<td> Hands-on activities </td><br />
<tr><br />
<td><br/><br/>Evening<br/><br/></td><br />
<td> </td><br />
<td> Social event </td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/626097/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Carandraug|Carnë Draug]]<br />
* [[User:CdF|Carlo de Falco]]<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
== Tips and tricks ==<br />
* A normal lunch at CERN costs about 15 CHF, inclusive of one coffee and one delicious dessert.<br />
* You can pay with CHF and EUR in CERN (the drawback is always CHF) and most of stores and restaurants in Geneva<br />
* The AC power plugs you'll find at CERN are SEV_1011 (https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets#Swiss_SEV_1011). You can borrow one adaptor at the hostel reception.<br />
* As guest you can only enter and exit the main CERN area through entrance B<br />
* A bus ride from the airport to CERN is free of charge, if you take a ticket at the vending machine in the baggage claim area. Should you miss that vending machine, a ticket will cost you 3.00 CHF. https://genevalunch.com/guides/travel/the-cheerful-traveler-geneva-airport-public-transport/<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2017]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2019]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2018]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2018&diff=10552OctConf 20182017-12-01T15:28:09Z<p>Cdf: /* Schedule */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2018 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 12th until March 15th. <br />
<br />
The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: <br />
* Octave is a fundamental tool of analysis and research for hundreds of CERN scientists<br />
* Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The two-day plus two-half-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond.<br />
<br />
Our [[OctConf_2018#Scientific_committee | scientific committee]] is working out the details of the programme, which will include: a presentation by Octave's creator and main maintainer John W. Eaton in the CERN Main Auditorium (Monday afternoon), several interesting talks about applications of Octave to various scientific domains, code sprints, and a session to promote the open-source supported by public institutions as a model for free and successful development. The call for contributions and abstract will be open soon.<br />
<br />
The key members of the Octave development team will participate in the conference, both from oversea and from Europe. You can find updated information on the programme in this Wiki page and we are filling the [https://indico.cern.ch/event/626097/ Indico] timetable.<br />
<br />
== Dates ==<br />
<br />
The conference will take place on Week 11, from March 12th until March 15th 2018.<br />
<br />
'''Duration''': 1/2 + 2 + 1/2 days (requires >=4 days break from work)<br />
<br />
== Committees ==<br />
=== Scientific committee ===<br />
'''Duties''': Recruit invited speakers, finalize the programme schedule, review and select presentations, review and select posters, chairing during conference. <br />
<br />
'''Members''':<br />
<br />
* [[User:Carandraug|Carnë Draug]]<br />
* Carlo de Falco<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* Rafael Vázquez<br />
<br />
<br />
Use the [mailto:maintainers@octave.org maintainers mailing list] to communicate with these people.<br />
<br />
=== Hosting committtee ===<br />
'''Duties''': Arrange and reserve rooms, catering, social event, and other logistics for the conference.<br />
<br />
'''Members''':<br />
<br />
* Andrea Latina<br />
* John Evans<br />
* Melissa Gaillard<br />
<br />
== Location ==<br />
The upcoming Octconf 2018 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
TBA<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday 12.03<br/>(Opening)</th><br />
<th width="220">Tuesday 13.03<br/>(Tutorials)</th><br />
<th width="250">Wednesday 14.03<br/>(Unconference)</th><br />
<th width="220">Thursday 15.03<br/>(Closing)</th><br />
</tr><br />
<tr><br />
<td><br/><br/>Morning<br/><br/></td><br />
<td bgcolor= #ffb3b3></td><br />
<td> Unconference </td><br />
<td> Unconference </td><br />
<td> Closing and OctConf 2019 planning </td><br />
</tr><br />
<tr><br />
<td><br/><br/>Noon<br/><br/> </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Farewell lunch</td><br />
</tr><br />
<tr><br />
<td rowspan=2><br/><br/>Afternoon<br/><br/></td><br />
<td> Unconference </td><br />
<td rowspan=2> Unconference </td><br />
<td rowspan=2> Visit to CERN </td><br />
<td bgcolor=#ffb3b3 rowspan=3></td><br />
</tr><br />
<td> Hands-on activities </td><br />
<tr><br />
<td><br/><br/>Evening<br/><br/></td><br />
<td> </td><br />
<td> Social event </td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/626097/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Carandraug|Carnë Draug]]<br />
* [[User:CdF|Carlo de Falco]]<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
== Tips and tricks ==<br />
* A normal lunch at CERN costs about 15 CHF, inclusive of one coffee and one delicious dessert.<br />
* You can pay with CHF and EUR in CERN (the drawback is always CHF) and most of stores and restaurants in Geneva<br />
* The AC power plugs you'll find at CERN are SEV_1011 (https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets#Swiss_SEV_1011). You can borrow one adaptor at the hostel reception.<br />
* As guest you can only enter and exit the main CERN area through entrance B<br />
* A bus ride from the airport to CERN is free of charge, if you take a ticket at the vending machine in the baggage claim area. Should you miss that vending machine, a ticket will cost you 3.00 CHF. https://genevalunch.com/guides/travel/the-cheerful-traveler-geneva-airport-public-transport/<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2017]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2019]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2018]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2018&diff=10551OctConf 20182017-12-01T15:27:04Z<p>Cdf: /* Schedule */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2018 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 12th until March 15th. <br />
<br />
The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: <br />
* Octave is a fundamental tool of analysis and research for hundreds of CERN scientists<br />
* Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The two-day plus two-half-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond.<br />
<br />
Our [[OctConf_2018#Scientific_committee | scientific committee]] is working out the details of the programme, which will include: a presentation by Octave's creator and main maintainer John W. Eaton in the CERN Main Auditorium (Monday afternoon), several interesting talks about applications of Octave to various scientific domains, code sprints, and a session to promote the open-source supported by public institutions as a model for free and successful development. The call for contributions and abstract will be open soon.<br />
<br />
The key members of the Octave development team will participate in the conference, both from oversea and from Europe. You can find updated information on the programme in this Wiki page and we are filling the [https://indico.cern.ch/event/626097/ Indico] timetable.<br />
<br />
== Dates ==<br />
<br />
The conference will take place on Week 11, from March 12th until March 15th 2018.<br />
<br />
'''Duration''': 1/2 + 2 + 1/2 days (requires >=4 days break from work)<br />
<br />
== Committees ==<br />
=== Scientific committee ===<br />
'''Duties''': Recruit invited speakers, finalize the programme schedule, review and select presentations, review and select posters, chairing during conference. <br />
<br />
'''Members''':<br />
<br />
* [[User:Carandraug|Carnë Draug]]<br />
* Carlo de Falco<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* Rafael Vázquez<br />
<br />
<br />
Use the [mailto:maintainers@octave.org maintainers mailing list] to communicate with these people.<br />
<br />
=== Hosting committtee ===<br />
'''Duties''': Arrange and reserve rooms, catering, social event, and other logistics for the conference.<br />
<br />
'''Members''':<br />
<br />
* Andrea Latina<br />
* John Evans<br />
* Melissa Gaillard<br />
<br />
== Location ==<br />
The upcoming Octconf 2018 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
TBA<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday 12.03<br/>(Opening)</th><br />
<th width="220">Tuesday 13.03<br/>(Tutorials)</th><br />
<th width="250">Wednesday 14.03<br/>(Unconference)</th><br />
<th width="220">Thursday 15.03<br/>(Closing)</th><br />
</tr><br />
<tr><br />
<td><br/><br/>Morning<br/><br/></td><br />
<td bgcolor= #ffb3b3></td><br />
<td> Talks </td><br />
<td> Talks </td><br />
<td> Closing and OctConf 2019 planning </td><br />
</tr><br />
<tr><br />
<td><br/><br/>Noon<br/><br/> </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Farewell lunch</td><br />
</tr><br />
<tr><br />
<td rowspan=2><br/><br/>Afternoon<br/><br/></td><br />
<td> Talks </td><br />
<td rowspan=2> </td><br />
<td rowspan=2> Visit to CERN </td><br />
<td bgcolor=#ffb3b3 rowspan=3></td><br />
</tr><br />
<td> Hands-on activities </td><br />
<tr><br />
<td><br/><br/>Evening<br/><br/></td><br />
<td> </td><br />
<td> Social event </td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/626097/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Carandraug|Carnë Draug]]<br />
* [[User:CdF|Carlo de Falco]]<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
== Tips and tricks ==<br />
* A normal lunch at CERN costs about 15 CHF, inclusive of one coffee and one delicious dessert.<br />
* You can pay with CHF and EUR in CERN (the drawback is always CHF) and most of stores and restaurants in Geneva<br />
* The AC power plugs you'll find at CERN are SEV_1011 (https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets#Swiss_SEV_1011). You can borrow one adaptor at the hostel reception.<br />
* As guest you can only enter and exit the main CERN area through entrance B<br />
* A bus ride from the airport to CERN is free of charge, if you take a ticket at the vending machine in the baggage claim area. Should you miss that vending machine, a ticket will cost you 3.00 CHF. https://genevalunch.com/guides/travel/the-cheerful-traveler-geneva-airport-public-transport/<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2017]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2019]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2018]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2018&diff=10550OctConf 20182017-12-01T15:23:38Z<p>Cdf: /* Schedule */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2018 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 12th until March 15th. <br />
<br />
The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: <br />
* Octave is a fundamental tool of analysis and research for hundreds of CERN scientists<br />
* Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The two-day plus two-half-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond.<br />
<br />
Our [[OctConf_2018#Scientific_committee | scientific committee]] is working out the details of the programme, which will include: a presentation by Octave's creator and main maintainer John W. Eaton in the CERN Main Auditorium (Monday afternoon), several interesting talks about applications of Octave to various scientific domains, code sprints, and a session to promote the open-source supported by public institutions as a model for free and successful development. The call for contributions and abstract will be open soon.<br />
<br />
The key members of the Octave development team will participate in the conference, both from oversea and from Europe. You can find updated information on the programme in this Wiki page and we are filling the [https://indico.cern.ch/event/626097/ Indico] timetable.<br />
<br />
== Dates ==<br />
<br />
The conference will take place on Week 11, from March 12th until March 15th 2018.<br />
<br />
'''Duration''': 1/2 + 2 + 1/2 days (requires >=4 days break from work)<br />
<br />
== Committees ==<br />
=== Scientific committee ===<br />
'''Duties''': Recruit invited speakers, finalize the programme schedule, review and select presentations, review and select posters, chairing during conference. <br />
<br />
'''Members''':<br />
<br />
* [[User:Carandraug|Carnë Draug]]<br />
* Carlo de Falco<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* Rafael Vázquez<br />
<br />
<br />
Use the [mailto:maintainers@octave.org maintainers mailing list] to communicate with these people.<br />
<br />
=== Hosting committtee ===<br />
'''Duties''': Arrange and reserve rooms, catering, social event, and other logistics for the conference.<br />
<br />
'''Members''':<br />
<br />
* Andrea Latina<br />
* John Evans<br />
* Melissa Gaillard<br />
<br />
== Location ==<br />
The upcoming Octconf 2018 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
TBA<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday 12.03<br/>(Opening)</th><br />
<th width="220">Tuesday 13.03<br/>(Tutorials)</th><br />
<th width="250">Wednesday 14.03<br/>(Unconference)</th><br />
<th width="220">Thursday 15.03<br/>(Closing)</th><br />
</tr><br />
<tr><br />
<td><br/><br/>Morning<br/><br/></td><br />
<td bgcolor= #ffb3b3></td><br />
<td> Talks </td><br />
<td> Talks </td><br />
<td> Closing and OctConf 2019 planning </td><br />
</tr><br />
<tr><br />
<td><br/><br/>Noon<br/><br/> </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Farewell lunch</td><br />
</tr><br />
<tr><br />
<td rowspan=2><br/><br/>Afternoon<br/><br/></td><br />
<td> Talks </td><br />
<td rowspan=2> Visit to CERN </td><br />
<td rowspan=2> Hands-on activities </td><br />
<td bgcolor=#ffb3b3 rowspan=3></td><br />
</tr><br />
<td> Hands-on activities </td><br />
<tr><br />
<td><br/><br/>Evening<br/><br/></td><br />
<td> Social event</td><br />
<td> Hands-on activities </td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/626097/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Carandraug|Carnë Draug]]<br />
* [[User:CdF|Carlo de Falco]]<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
== Tips and tricks ==<br />
* A normal lunch at CERN costs about 15 CHF, inclusive of one coffee and one delicious dessert.<br />
* You can pay with CHF and EUR in CERN (the drawback is always CHF) and most of stores and restaurants in Geneva<br />
* The AC power plugs you'll find at CERN are SEV_1011 (https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets#Swiss_SEV_1011). You can borrow one adaptor at the hostel reception.<br />
* As guest you can only enter and exit the main CERN area through entrance B<br />
* A bus ride from the airport to CERN is free of charge, if you take a ticket at the vending machine in the baggage claim area. Should you miss that vending machine, a ticket will cost you 3.00 CHF. https://genevalunch.com/guides/travel/the-cheerful-traveler-geneva-airport-public-transport/<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2017]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2019]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2018]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2018&diff=10549OctConf 20182017-12-01T15:21:40Z<p>Cdf: /* Schedule */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2018 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 12th until March 15th. <br />
<br />
The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: <br />
* Octave is a fundamental tool of analysis and research for hundreds of CERN scientists<br />
* Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The two-day plus two-half-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond.<br />
<br />
Our [[OctConf_2018#Scientific_committee | scientific committee]] is working out the details of the programme, which will include: a presentation by Octave's creator and main maintainer John W. Eaton in the CERN Main Auditorium (Monday afternoon), several interesting talks about applications of Octave to various scientific domains, code sprints, and a session to promote the open-source supported by public institutions as a model for free and successful development. The call for contributions and abstract will be open soon.<br />
<br />
The key members of the Octave development team will participate in the conference, both from oversea and from Europe. You can find updated information on the programme in this Wiki page and we are filling the [https://indico.cern.ch/event/626097/ Indico] timetable.<br />
<br />
== Dates ==<br />
<br />
The conference will take place on Week 11, from March 12th until March 15th 2018.<br />
<br />
'''Duration''': 1/2 + 2 + 1/2 days (requires >=4 days break from work)<br />
<br />
== Committees ==<br />
=== Scientific committee ===<br />
'''Duties''': Recruit invited speakers, finalize the programme schedule, review and select presentations, review and select posters, chairing during conference. <br />
<br />
'''Members''':<br />
<br />
* [[User:Carandraug|Carnë Draug]]<br />
* Carlo de Falco<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* Rafael Vázquez<br />
<br />
<br />
Use the [mailto:maintainers@octave.org maintainers mailing list] to communicate with these people.<br />
<br />
=== Hosting committtee ===<br />
'''Duties''': Arrange and reserve rooms, catering, social event, and other logistics for the conference.<br />
<br />
'''Members''':<br />
<br />
* Andrea Latina<br />
* John Evans<br />
* Melissa Gaillard<br />
<br />
== Location ==<br />
The upcoming Octconf 2018 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
TBA<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday 12.03<br/>(Opening)</th><br />
<th width="220">Tuesday 13.03<br/>(Tutorial)</th><br />
<th width="250">Wednesday 14.03<br/>(Unconference)</th><br />
<th width="220">Thursday 15.03<br/>(Closing)</th><br />
</tr><br />
<tr><br />
<td><br/><br/>Morning<br/><br/></td><br />
<td bgcolor= #ffb3b3></td><br />
<td> Talks </td><br />
<td> Talks </td><br />
<td> Unconference <br/> and OctConf 2019 </td><br />
</tr><br />
<tr><br />
<td><br/><br/>Noon<br/><br/> </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Plenary talk <br/> and Lunch </td><br />
<td> Farewell lunch</td><br />
</tr><br />
<tr><br />
<td rowspan=2><br/><br/>Afternoon<br/><br/></td><br />
<td> Talks </td><br />
<td rowspan=2> Visit to CERN </td><br />
<td rowspan=2> Hands-on activities </td><br />
<td bgcolor=#ffb3b3 rowspan=3></td><br />
</tr><br />
<td> Hands-on activities </td><br />
<tr><br />
<td><br/><br/>Evening<br/><br/></td><br />
<td> Social event</td><br />
<td> Hands-on activities </td><br />
<td></td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/626097/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:jwe|John W. Eaton]]<br />
* [[User:JordiGH|Jordi Gutiérrez Hermoso]]<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Carandraug|Carnë Draug]]<br />
* [[User:CdF|Carlo de Falco]]<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
== Tips and tricks ==<br />
* A normal lunch at CERN costs about 15 CHF, inclusive of one coffee and one delicious dessert.<br />
* You can pay with CHF and EUR in CERN (the drawback is always CHF) and most of stores and restaurants in Geneva<br />
* The AC power plugs you'll find at CERN are SEV_1011 (https://en.wikipedia.org/wiki/AC_power_plugs_and_sockets#Swiss_SEV_1011). You can borrow one adaptor at the hostel reception.<br />
* As guest you can only enter and exit the main CERN area through entrance B<br />
* A bus ride from the airport to CERN is free of charge, if you take a ticket at the vending machine in the baggage claim area. Should you miss that vending machine, a ticket will cost you 3.00 CHF. https://genevalunch.com/guides/travel/the-cheerful-traveler-geneva-airport-public-transport/<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2017]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2019]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2018]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Secs1d_package&diff=10525Secs1d package2017-10-23T14:12:36Z<p>Cdf: The SECS1D Package</p>
<hr />
<div>* Example, a PIN diode<br />
<br />
<code><br />
% physical constants and parameters<br />
secs1d_physical_constants;<br />
secs1d_silicon_material_properties;<br />
<br />
% geometry<br />
L = 10e-6; % [m] <br />
xm = L/2;<br />
<br />
Nelements = 1000;<br />
x = linspace (0, L, Nelements+1)';<br />
sinodes = [1:length(x)];<br />
<br />
% dielectric constant (silicon)<br />
er = esir * ones (Nelements, 1);<br />
<br />
% doping profile [m^{-3}]<br />
Na = 1e23 * (x <= xm);<br />
Nd = 1e23 * (x > xm);<br />
<br />
% avoid zero doping<br />
D = Nd - Na; <br />
<br />
% initial guess for n, p, V, phin, phip<br />
V_p = -1;<br />
V_n = 0;<br />
<br />
Fp = V_p * (x <= xm);<br />
Fn = Fp;<br />
<br />
p = abs (D) / 2 .* (1 + sqrt (1 + 4 * (ni./abs(D)) .^2)) .* (x <= xm) + ...<br />
ni^2 ./ (abs (D) / 2 .* (1 + sqrt (1 + 4 * (ni ./ abs (D)) .^2))) .* (x > xm);<br />
<br />
n = abs (D) / 2 .* (1 + sqrt (1 + 4 * (ni ./ abs (D)) .^ 2)) .* (x > xm) + ...<br />
ni ^ 2 ./ (abs (D) / 2 .* (1 + sqrt (1 + 4 * (ni ./ abs (D)) .^2))) .* (x <= xm);<br />
<br />
V = Fn + Vth * log (n / ni);<br />
<br />
% scaling factors<br />
xbar = L; % [m]<br />
nbar = norm(D, 'inf'); % [m^{-3}]<br />
Vbar = Vth; % [V]<br />
mubar = max (u0n, u0p); % [m^2 V^{-1} s^{-1}]<br />
tbar = xbar^2 / (mubar * Vbar); % [s]<br />
Rbar = nbar / tbar; % [m^{-3} s^{-1}]<br />
Ebar = Vbar / xbar; % [V m^{-1}]<br />
Jbar = q * mubar * nbar * Ebar; % [A m^{-2}]<br />
CAubar = Rbar / nbar^3; % [m^6 s^{-1}]<br />
abar = 1/xbar; % [m^{-1}]<br />
<br />
% scaling procedure<br />
l2 = e0 * Vbar / (q * nbar * xbar^2);<br />
theta = ni / nbar;<br />
<br />
xin = x / xbar;<br />
Din = D / nbar;<br />
Nain = Na / nbar;<br />
Ndin = Nd / nbar;<br />
pin = p / nbar;<br />
nin = n / nbar;<br />
Vin = V / Vbar;<br />
Fnin = Vin - log (nin);<br />
Fpin = Vin + log (pin);<br />
<br />
tnin = tn / tbar;<br />
tpin = tp / tbar;<br />
<br />
u0nin = u0n / mubar;<br />
uminnin = uminn / mubar;<br />
vsatnin = vsatn / (mubar * Ebar);<br />
<br />
u0pin = u0p / mubar;<br />
uminpin = uminp / mubar;<br />
vsatpin = vsatp / (mubar * Ebar);<br />
<br />
Nrefnin = Nrefn / nbar;<br />
Nrefpin = Nrefp / nbar;<br />
<br />
Cnin = Cn / CAubar;<br />
Cpin = Cp / CAubar;<br />
<br />
anin = an / abar;<br />
apin = ap / abar;<br />
Ecritnin = Ecritn / Ebar;<br />
Ecritpin = Ecritp / Ebar;<br />
<br />
% tolerances for convergence checks<br />
toll = 1e-3;<br />
maxit = 1000;<br />
ptoll = 1e-12;<br />
pmaxit = 1000;<br />
<br />
% solve the problem using the full DD model<br />
[nout, pout, Vout, Fnout, Fpout, Jnout, Jpout, it, res] = ...<br />
secs1d_dd_gummel_map (xin, Din, Nain, Ndin, pin, nin, Vin, Fnin, Fpin, ...<br />
l2, er, u0nin, uminnin, vsatnin, betan, Nrefnin, ...<br />
u0pin, uminpin, vsatpin, betap, Nrefpin, theta, ...<br />
tnin, tpin, Cnin, Cpin, anin, apin, ...<br />
Ecritnin, Ecritpin, toll, maxit, ptoll, pmaxit); <br />
<br />
% Descaling procedure<br />
n = nout*nbar;<br />
p = pout*nbar;<br />
V = Vout*Vbar;<br />
Fn = V - Vth*log(n/ni);<br />
Fp = V + Vth*log(p/ni);<br />
dV = diff(V);<br />
dx = diff(x);<br />
E = -dV./dx;<br />
<br />
% band structure<br />
Efn = -Fn;<br />
Efp = -Fp;<br />
Ec = Vth*log(Nc./n)+Efn;<br />
Ev = -Vth*log(Nv./p)+Efp;<br />
<br />
plot (x, Efn, x, Efp, x, Ec, x, Ev)<br />
legend ('Efn', 'Efp', 'Ec', 'Ev')<br />
axis tight <br />
</code><br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Odepkg&diff=10524Odepkg2017-10-19T08:52:55Z<p>Cdf: </p>
<hr />
<div>[https://bitbucket.org/odepkg/odepkg odepkg] is part of the octave-forge project. It contains additional functions for numerically solving ordinary differential equations.<br />
<br />
The most recent official release is [https://octave.sourceforge.io/download.php?package=odepkg-0.8.5.tar.gz version 0.8.5], which however is out of date (it includes functions which have been transferred to core Octave) and [https://savannah.gnu.org/bugs/?func=detailitem&item_id=46309 will] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=48280 not] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=50684 install] at all with recent compilers and versions of Octave.<br />
<br />
Until a new official release is made, Octave 4.2.x users might consider installing a development snapshot of the package, as follows:<br />
<br />
<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/default.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
To install under the 4.3.0+ development version of Octave one can use the following instead:<br />
<br />
<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/octave43.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Odepkg&diff=10523Odepkg2017-10-19T08:51:15Z<p>Cdf: </p>
<hr />
<div>[https://bitbucket.org/odepkg/odepkg odepkg] is part of the octave-forge project. It contains additional functions for numerically solving ordinary differential equations.<br />
<br />
The most recent official release is [https://octave.sourceforge.io/download.php?package=odepkg-0.8.5.tar.gz version 0.8.5], which however is out of date (it includes functions which have been transferred to core Octave) and [https://savannah.gnu.org/bugs/?func=detailitem&item_id=46309 will] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=48280 not] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=50684 install] at all with recent compilers and versions of Octave.<br />
<br />
Until a new official release is made, Octave 4.2.x users might consider installing a development snapshot of the package, as follows:<br />
<code><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/default.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</code><br />
<br />
To install under the 4.3.0+ development version of Octave one can use the following instead:<br />
<br />
<code><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/octave43.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</code><br />
<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Odepkg&diff=10522Odepkg2017-10-19T08:49:56Z<p>Cdf: </p>
<hr />
<div>[https://bitbucket.org/odepkg/odepkg odepkg] is part of the octave-forge project. It contains additional functions for numerically solving ordinary differential equations.<br />
<br />
The most recent official release is [https://octave.sourceforge.io/download.php?package=odepkg-0.8.5.tar.gz version 0.8.5], which however is out of date (it includes functions which have been transferred to core Octave) and [https://savannah.gnu.org/bugs/?func=detailitem&item_id=46309 will] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=48280 not] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=50684 install] at all with recent compilers and versions of Octave.<br />
<br />
Until a new official release is made, Octave 4.2.x users might consider installing a development snapshot of the package, as follows:<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/default.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
To install under the 4.3.0+ development version of Octave one can use the following instead:<br />
<br />
<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/octave43.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Odepkg&diff=10521Odepkg2017-10-19T08:45:35Z<p>Cdf: </p>
<hr />
<div>[https://bitbucket.org/odepkg/odepkg odepkg] is part of the octave-forge project. It contains additional functions for numerically solving ordinary differential equations.<br />
<br />
The most recent official release is [https://octave.sourceforge.io/download.php?package=odepkg-0.8.5.tar.gz version 0.8.5], which however is out of date (it includes functions which have been transferred to core Octave) and [https://savannah.gnu.org/bugs/?func=detailitem&item_id=46309 will] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=48280 not] [https://savannah.gnu.org/bugs/?func=detailitem&item_id=50684 install] at all with recent compilers and versions of Octave.<br />
<br />
Until a new official release is made, Octave 4.2.x users might consider installing a development snapshot of the package, as follows:<br />
<br />
<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/default.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
To install under the 4.3.0+ development version of Octave one can use the following instead:<br />
<br />
<nowiki><br />
[fname, success] = urlwrite ("https://bitbucket.org/odepkg/odepkg/get/octave43.tar.gz", [P_tmpdir "odepkg.tar.gz"]);<br />
assert (success)<br />
pkg ("install", fname)<br />
</nowiki><br />
<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10407Bim package2017-06-19T20:34:21Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]<br />
<br />
* [https://doi.org/10.1016/j.cma.2012.06.018 de Falco, C., Porro, M., Sacco, R. and Verri, M., 2012. Multiscale modeling and simulation of organic solar cells. Computer Methods in Applied Mechanics and Engineering, 245, pp.102-116.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-540-71980-9_5 de Falco, C., Denk, G. and Schultz, R., 2007. A demonstrator platform for coupled multiscale simulation. In Scientific Computing in Electrical Engineering (pp. 63-71). Springer Berlin Heidelberg.]<br />
<br />
* [https://doi.org/10.1016/j.orgel.2014.12.001 Maddalena, F., de Falco, C., Caironi, M. and Natali, D., 2015. Assessing the width of Gaussian density of states in organic semiconductors. Organic Electronics, 17, pp.304-318.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-642-12294-1_35 Alì, G., Bartel, A., Culpo, M. and de Falco, C., 2010. Analysis of a PDE thermal element model for electrothermal circuit simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 273-280). Springer Berlin Heidelberg.]<br />
<br />
* [http://onlinelibrary.wiley.com/doi/10.1002/pamm.200810065/full Culpo, M. and De Falco, C., 2008. Dynamical iteration schemes for coupled simulation in nanoelectronics. PAMM, 8(1), pp.10065-10068.]<br />
<br />
* [https://doi.org/10.1108/COMPEL-12-2012-0365 Porro, M., de Falco, C., Verri, M., Lanzani, G. and Sacco, R., 2014. Multiscale simulation of organic heterojunction light harvesting devices. COMPEL: The International Journal for Computation and Mathematics in Electrical and Electronic Engineering, 33(4), pp.1107-1122.]<br />
<br />
* [http://dx.doi.org/10.1063/1.4709483 Ciucci, F., de Falco, C., Guzman, M.I., Lee, S. and Honda, T., 2012. Chemisorption on semiconductors: The role of quantum corrections on the space charge regions in multiple dimensions. Applied Physics Letters, 100(18), p.183106.]<br />
<br />
* [https://link.springer.com/chapter/10.1007%2F978-3-642-12294-1_36 Culpo, M., de Falco, C., Denk, G. and Voigtmann, S., 2010. Automatic thermal network extraction and multiscale electro-thermal simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 281-288). Springer Berlin Heidelberg.]<br />
<br />
* [https://link.springer.com/chapter/10.1007/978-3-642-12110-4_33 Culpo, M., de Falco, C. and O’Riordan, E., 2010. Patches of finite elements for singularly-perturbed diffusion reaction equations with discontinuous coefficients. In Progress in Industrial Mathematics at ECMI 2008 (pp. 235-240). Springer Berlin Heidelberg.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10406Bim package2017-06-19T20:32:42Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]<br />
<br />
* [https://doi.org/10.1016/j.cma.2012.06.018 de Falco, C., Porro, M., Sacco, R. and Verri, M., 2012. Multiscale modeling and simulation of organic solar cells. Computer Methods in Applied Mechanics and Engineering, 245, pp.102-116.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-540-71980-9_5 de Falco, C., Denk, G. and Schultz, R., 2007. A demonstrator platform for coupled multiscale simulation. In Scientific Computing in Electrical Engineering (pp. 63-71). Springer Berlin Heidelberg.]<br />
<br />
* [https://doi.org/10.1016/j.orgel.2014.12.001 Maddalena, F., de Falco, C., Caironi, M. and Natali, D., 2015. Assessing the width of Gaussian density of states in organic semiconductors. Organic Electronics, 17, pp.304-318.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-642-12294-1_35 Alì, G., Bartel, A., Culpo, M. and de Falco, C., 2010. Analysis of a PDE thermal element model for electrothermal circuit simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 273-280). Springer Berlin Heidelberg.]<br />
<br />
* [http://onlinelibrary.wiley.com/doi/10.1002/pamm.200810065/full Culpo, M. and De Falco, C., 2008. Dynamical iteration schemes for coupled simulation in nanoelectronics. PAMM, 8(1), pp.10065-10068.]<br />
<br />
* [https://doi.org/10.1108/COMPEL-12-2012-0365 Porro, M., de Falco, C., Verri, M., Lanzani, G. and Sacco, R., 2014. Multiscale simulation of organic heterojunction light harvesting devices. COMPEL: The International Journal for Computation and Mathematics in Electrical and Electronic Engineering, 33(4), pp.1107-1122.]<br />
<br />
* [http://dx.doi.org/10.1063/1.4709483 Ciucci, F., de Falco, C., Guzman, M.I., Lee, S. and Honda, T., 2012. Chemisorption on semiconductors: The role of quantum corrections on the space charge regions in multiple dimensions. Applied Physics Letters, 100(18), p.183106.]<br />
<br />
* [https://link.springer.com/chapter/10.1007%2F978-3-642-12294-1_36 Culpo, M., de Falco, C., Denk, G. and Voigtmann, S., 2010. Automatic thermal network extraction and multiscale electro-thermal simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 281-288). Springer Berlin Heidelberg.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10405Bim package2017-06-19T20:31:07Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]<br />
<br />
* [https://doi.org/10.1016/j.cma.2012.06.018 de Falco, C., Porro, M., Sacco, R. and Verri, M., 2012. Multiscale modeling and simulation of organic solar cells. Computer Methods in Applied Mechanics and Engineering, 245, pp.102-116.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-540-71980-9_5 de Falco, C., Denk, G. and Schultz, R., 2007. A demonstrator platform for coupled multiscale simulation. In Scientific Computing in Electrical Engineering (pp. 63-71). Springer Berlin Heidelberg.]<br />
<br />
* [https://doi.org/10.1016/j.orgel.2014.12.001 Maddalena, F., de Falco, C., Caironi, M. and Natali, D., 2015. Assessing the width of Gaussian density of states in organic semiconductors. Organic Electronics, 17, pp.304-318.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-642-12294-1_35 Alì, G., Bartel, A., Culpo, M. and de Falco, C., 2010. Analysis of a PDE thermal element model for electrothermal circuit simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 273-280). Springer Berlin Heidelberg.]<br />
<br />
* [http://onlinelibrary.wiley.com/doi/10.1002/pamm.200810065/full Culpo, M. and De Falco, C., 2008. Dynamical iteration schemes for coupled simulation in nanoelectronics. PAMM, 8(1), pp.10065-10068.]<br />
<br />
* [https://doi.org/10.1108/COMPEL-12-2012-0365 Porro, M., de Falco, C., Verri, M., Lanzani, G. and Sacco, R., 2014. Multiscale simulation of organic heterojunction light harvesting devices. COMPEL: The International Journal for Computation and Mathematics in Electrical and Electronic Engineering, 33(4), pp.1107-1122.]<br />
<br />
* [http://dx.doi.org/10.1063/1.4709483 Ciucci, F., de Falco, C., Guzman, M.I., Lee, S. and Honda, T., 2012. Chemisorption on semiconductors: The role of quantum corrections on the space charge regions in multiple dimensions. Applied Physics Letters, 100(18), p.183106.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10404Bim package2017-06-19T20:28:21Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]<br />
<br />
* [https://doi.org/10.1016/j.cma.2012.06.018 de Falco, C., Porro, M., Sacco, R. and Verri, M., 2012. Multiscale modeling and simulation of organic solar cells. Computer Methods in Applied Mechanics and Engineering, 245, pp.102-116.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-540-71980-9_5 de Falco, C., Denk, G. and Schultz, R., 2007. A demonstrator platform for coupled multiscale simulation. In Scientific Computing in Electrical Engineering (pp. 63-71). Springer Berlin Heidelberg.]<br />
<br />
* [https://doi.org/10.1016/j.orgel.2014.12.001 Maddalena, F., de Falco, C., Caironi, M. and Natali, D., 2015. Assessing the width of Gaussian density of states in organic semiconductors. Organic Electronics, 17, pp.304-318.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-642-12294-1_35 Alì, G., Bartel, A., Culpo, M. and de Falco, C., 2010. Analysis of a PDE thermal element model for electrothermal circuit simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 273-280). Springer Berlin Heidelberg.]<br />
<br />
* [http://onlinelibrary.wiley.com/doi/10.1002/pamm.200810065/full Culpo, M. and De Falco, C., 2008. Dynamical iteration schemes for coupled simulation in nanoelectronics. PAMM, 8(1), pp.10065-10068.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10403Bim package2017-06-19T20:26:46Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]<br />
<br />
* [https://doi.org/10.1016/j.cma.2012.06.018 de Falco, C., Porro, M., Sacco, R. and Verri, M., 2012. Multiscale modeling and simulation of organic solar cells. Computer Methods in Applied Mechanics and Engineering, 245, pp.102-116.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-540-71980-9_5 de Falco, C., Denk, G. and Schultz, R., 2007. A demonstrator platform for coupled multiscale simulation. In Scientific Computing in Electrical Engineering (pp. 63-71). Springer Berlin Heidelberg.]<br />
<br />
* [https://doi.org/10.1016/j.orgel.2014.12.001 Maddalena, F., de Falco, C., Caironi, M. and Natali, D., 2015. Assessing the width of Gaussian density of states in organic semiconductors. Organic Electronics, 17, pp.304-318.]<br />
<br />
* [http://link.springer.com/chapter/10.1007/978-3-642-12294-1_35 Alì, G., Bartel, A., Culpo, M. and de Falco, C., 2010. Analysis of a PDE thermal element model for electrothermal circuit simulation. In Scientific Computing in Electrical Engineering SCEE 2008 (pp. 273-280). Springer Berlin Heidelberg.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10402Bim package2017-06-19T20:22:51Z<p>Cdf: /* Scientific papers using BIM */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]<br />
<br />
* [http://www.math.ualberta.ca/ijnam/Volume-7-2010/No-3-10/2010-03-04.pdf de Falco, C. and O'riordan, E., 2010. INTERIOR LAYERS IN A REACTION DIFFUSION EQUATION WITH A DISCONTINUOUS DIFFUSION COEFFICIENT. International Journal of Numerical Analysis & Modeling, 7(3).]<br />
<br />
* [https://doi.org/10.1016/j.cma.2010.01.018 de Falco, C., Sacco, R. and Verri, M., 2010. Analytical and numerical study of photocurrent transients in organic polymer solar cells. Computer Methods in Applied Mechanics and Engineering, 199(25), pp.1722-1732.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Bim_package&diff=10401Bim package2017-06-19T19:21:25Z<p>Cdf: /* External links */</p>
<hr />
<div>Package for solving Diffusion Advection Reaction (DAR) Partial Differential Equations based on the Finite Volume Scharfetter-Gummel (FVSG) method a.k.a Box Integration Method (BIM).<br />
<br />
== Tutorials ==<br />
=== 2D Diffusion Advection Reaction example ===<br />
<br />
This is a short example on how to use <tt>bim</tt> to solve a 2D Diffusion Advection Reaction problem.<br />
<!-- The complete code for this example is on [[Agora]] at this [http://agora.octave.org/snippet/1bqV link] -->.<br />
<br />
We want to solve the equation<br />
<br />
<math> -\mathrm{div}\ ( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) ) + u(x, y) = 1 \qquad \mbox{ in } \Omega</math><br />
<br />
<math> \varphi(x, y)\ =\ x + y </math><br />
<br />
with mixed Dirichlet / Neumann boundary conditions<br />
<br />
<math> u(x, y) = u_d(x, y)\qquad \mbox{ on } \Gamma_D </math><br />
<br />
<math> -( \varepsilon\ \nabla u(x, y) - \nabla \varphi(x,y)\ u(x, y) ) \cdot \mathbf{n} = j_N(x, y)\qquad \mbox{ on } \Gamma_N</math><br />
<br />
<b> Create the mesh and precompute the mesh properties </b><br />
<br />
To define the geometry of the domain we can use [http://gmsh.geuz.org gmsh].<br />
<br />
the following gmsh input <br />
<br />
<pre><br />
Point (1) = {0, 0, 0, 0.1};<br />
Point (2) = {1, 1, 0, 0.1};<br />
Point (3) = {1, 0.9, 0, 0.1};<br />
Point (4) = {0, 0.1, 0, 0.1};<br />
Point (5) = {0.3,0.1,-0,0.1};<br />
Point (6) = {0.4,0.4,-0,0.1};<br />
Point (7) = {0.5,0.6,0,0.1};<br />
Point (8) = {0.6,0.9,0,0.1};<br />
Point (9) = {0.8,0.8,0,0.1};<br />
Point (10) = {0.2,0.2,-0,0.1};<br />
Point (11) = {0.3,0.5,0,0.1};<br />
Point (12) = {0.4,0.7,0,0.1};<br />
Point (13) = {0.5,1,0,0.1};<br />
Point (14) = {0.8,0.9,0,0.1};<br />
<br />
Line (1) = {3, 2};<br />
Line (2) = {4, 1};<br />
<br />
CatmullRom(3) = {1,5,6,7,8,9,3};<br />
CatmullRom(4) = {4,10,11,12,13,14,2};<br />
Line Loop(15) = {3,1,-4,2};<br />
Plane Surface(16) = {15};<br />
</pre><br />
<br />
will produce the geometry below<br />
<br />
[[File:fiume.png]]<br />
<br />
we need to load the mesh into Octave and precompute mesh properties<br />
check out the tutorial for the [[msh_package|msh package]] for info <br />
on the mesh structure<br />
<br />
{{Code|Meshing the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[mesh] = msh2m_gmsh ("fiume","scale",1,"clscale",.1);<br />
[mesh] = bim2c_mesh_properties (mesh);<br />
</syntaxhighlight>}}<br />
<br />
to see the mesh you can use functions from the [[fpl_package|fpl package]]<br />
<br />
{{Code|Visualizing the mesh for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdemesh (mesh.p, mesh.e, mesh.t)<br />
view (2)<br />
</syntaxhighlight>}} <br />
<br />
[[File:fiume_msh.png]]<br />
<br />
<br />
<b> Set the coefficients for the problem:</b><br />
<br />
Get the node coordinates from the mesh structure<br />
<br />
{{Code|Get mesh coordinates in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
xu = mesh.p(1,:).';<br />
yu = mesh.p(2,:).';<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
Get the number of elements and nodes in the mesh<br />
<br />
{{Code|Get number of elements in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
nelems = columns (mesh.t);<br />
nnodes = columns (mesh.p);<br />
</syntaxhighlight>}} <br />
<br />
{{Code|Set value of coefficients for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
epsilon = .1;<br />
phi = xu + yu;<br />
</syntaxhighlight>}} <br />
<br />
<b> Construct the discretized operators</b><br />
<br />
{{Code|Discretized operators for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
AdvDiff = bim2a_advection_diffusion (mesh, epsilon, 1, 1, phi);<br />
Mass = bim2a_reaction (mesh, 1, 1);<br />
b = bim2a_rhs (mesh,f,g);<br />
A = AdvDiff + Mass;<br />
</syntaxhighlight>}}<br />
<br />
<b> To Apply Boundary Conditions, partition LHS and RHS</b><br />
<br />
The tags of the sides are assigned by gmsh we let <math> \Gamma_D </math> be composed by sides 1 and 2<br />
and <math> \Gamma_D </math> be the rest of the boundary<br />
<br />
{{Code|Boundary conditions for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
GammaD = bim2c_unknowns_on_side (mesh, [1 2]); ## DIRICHLET NODES LIST<br />
GammaN = bim2c_unknowns_on_side (mesh, [3 4]); ## NEUMANN NODES LIST<br />
GammaN = setdiff (GammaN, GammaD);<br />
<br />
jn = zeros (length (GammaN),1); ## PRESCRIBED NEUMANN FLUXES<br />
ud = 3*xu; ## DIRICHLET DATUM<br />
Omega = setdiff (1:nnodes, union (GammaD, GammaN)); ## INTERIOR NODES LIST<br />
<br />
Add = A(GammaD, GammaD);<br />
Adn = A(GammaD, GammaN); ## shoud be all zeros hopefully!!<br />
Adi = A(GammaD, Omega); <br />
<br />
And = A(GammaN, GammaD); ## shoud be all zeros hopefully!!<br />
Ann = A(GammaN, GammaN);<br />
Ani = A(GammaN, Omega); <br />
<br />
Aid = A(Omega, GammaD);<br />
Ain = A(Omega, GammaN); <br />
Aii = A(Omega, Omega); <br />
<br />
bd = b(GammaD);<br />
bn = b(GammaN); <br />
bi = b(Omega); <br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Solve for the tracer density</B><br />
<br />
{{Code|Compute solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
temp = [Ann Ani ; Ain Aii ] \ [ jn+bn-And*ud(GammaD) ; bi-Aid*ud(GammaD)];<br />
u = ud;<br />
u(GammaN) = temp(1:numel (GammaN));<br />
u(Omega) = temp(length(GammaN)+1:end);<br />
</syntaxhighlight>}}<br />
<br />
<b> Compute the fluxes through Dirichlet sides</b><br><br />
<br />
{{Code|Boundary fluxes in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
jd = [Add Adi Adn] * u([GammaD; Omega; GammaN]) - bd;<br />
</syntaxhighlight>}}<br />
<br />
<br />
<B> Compute the gradient of the solution </B><br />
<br />
{{Code|Gradient of solution in the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
[gx, gy] = bim2c_pde_gradient (mesh, u);<br />
</syntaxhighlight>}}<br />
<br />
<B> Compute the internal Advection-Diffusion flux</B><br />
<br />
{{Code|Total flux for the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
[jxglob, jyglob] = bim2c_global_flux (mesh, u, epsilon*ones(nelems, 1), ones(nnodes, 1), ones(nnodes, 1), phi);<br />
</syntaxhighlight>}}<br />
<br />
<B> Export data to VTK format</B><br />
<br />
The resut can be exported to vtk format to visualize with [[http://www.paraview.org|paraview]] <br />
or [[https://wci.llnl.gov/codes/visit/|visit]]<br />
<br />
{{Code|Export the solution of the 2D problem to vtk|<syntaxhighlight lang="octave" style="font-size:13px"><br />
fpl_vtk_write_field ("vtkdata", mesh, {u, "Solution"}, {[gx; gy]', "Gradient"}, 1);<br />
</syntaxhighlight>}}<br />
<br />
you can also plot your data directly in Octave using <code> pdesurf </code><br />
<br />
{{Code|Rubbersheet visualization of the solution of the 2D problem|<syntaxhighlight lang="octave" style="font-size:13px"><br />
pdesurf (mesh.p, mesh.t, u)<br />
</syntaxhighlight>}}<br />
<br />
it will look like this<br />
<br />
[[File:fiume_sol_pdesurf.png|500px]]<br />
<br />
=== 3D Time dependent problem ===<br />
<br />
Here is an example of a 3D time-dependent Advection-Diffusion equation that uses <code> lsode </code> for time-stepping.<br />
<br />
The equation being solved is<br />
<br />
<math> \frac{\partial u}{\partial t} - \mathrm{div } \left(.01 \nabla u - u \nabla \varphi \right) <br />
= 0 \qquad \mbox{ in } \Omega \times [0, T] =[0, 1]^3 \times [0, 1] </math><br />
<br />
<math> ~\varphi = x + y - z </math><br />
<br />
<math> - \left(.01 \nabla u - u \nabla \varphi \right) \cdot \mathbf{n} = 0 <br />
\qquad \mbox{ on } \partial \Omega</math><br />
<br />
The initial condition is<br />
<br />
<math> u = \exp (- \left(\frac{x-.2}{.2}\right)^2 - \left(\frac{y-.2}{.2}\right)^2 - \left(\frac{z-.2}{.2}\right)^2)</math><br />
<br />
{{Code|Define the 3D problem|<syntaxhighlight lang="octave" style="font-size:13px"> <br />
pkg load bim<br />
<br />
x = linspace (0, 1, 40);<br />
y = z = linspace (0, 1, 20);<br />
msh = bim3c_mesh_properties (msh3m_structured_mesh (x, y, z, 1, 1:6));<br />
nn = columns (msh.p);<br />
ne = columns (msh.t);<br />
<br />
x = msh.p(1, :).';<br />
y = msh.p(2, :).';<br />
z = msh.p(3, :).';<br />
<br />
x0 = .2; sx = .1;<br />
y0 = .2; sy = .1;<br />
z0 = .8; sz = .1;<br />
<br />
u = exp (- ((x-x0)/(2*sx)) .^2 - ((y-y0)/(2*sy)) .^2 - ((z-z0)/(2*sz)) .^2);<br />
<br />
A = bim3a_advection_diffusion (msh, .01*ones(ne, 1), 100*(x+y-z));<br />
M = bim3a_reaction (msh, 1, 1);<br />
<br />
function du = f (u, t, A, M)<br />
du = - M \ (A * u);<br />
endfunction <br />
<br />
time = linspace (0, 1, 30);<br />
lsode_options ("integration method", "adams");<br />
U = lsode (@(u, t) f(u, t, A, M), u, time);<br />
<br />
for ii = 1:1:numel (time)<br />
name = sprintf ("u_%3.3d", ii);<br />
delete ([name ".vtu"]);<br />
fpl_vtk_write_field (name, msh, {U(ii,:)', 'u'}, {}, 1);<br />
endfor<br />
</syntaxhighlight>}}<br />
<br />
[http://youtu.be/2E6Z_AcV8CQ This is a video] showing the .3 isosurface of the solution.<br />
<br />
== External links ==<br />
* [http://octave.sourceforge.net/bim/index.html BIM package at Octave Forge].<br />
<br />
[[Category:Octave-Forge]]<br />
<br />
== Scientific papers using BIM ==<br />
<br />
* [https://doi.org/10.1016/j.jcp.2004.10.029 de Falco, C., Gatti, E., Lacaita, A. L., & Sacco, R. (2005). Quantum-corrected drift-diffusion models for transport in semiconductor devices. Journal of Computational Physics, 204(2), 533-561.]<br />
<br />
* [https://doi.org/10.1016/j.jcp.2008.11.010 de Falco, C., Jerome, J.W. and Sacco, R., 2009. Quantum-corrected drift-diffusion models: Solution fixed point map and finite element approximation. Journal of Computational Physics, 228(5), pp.1770-1789.]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=9941Summer of Code - Getting Started2017-03-09T21:18:51Z<p>Cdf: /* ode15s : Matlab Compatible DAE solver */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://summerofcode.withgoogle.com Google] and [http://sophia.estec.esa.int/socis ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
== Help Us Get To Know You == <br />
*: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
*:* '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
*:* '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, answer questions from users, show us that you are motivated, and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Do not wait for us to tell you what to do'''<br />
*: You should be doing something that interests you, and should not need us to tell you what to do. Similarly, you shouldn't ask us what to do either.<br />
*:* When you email the list and mentors, do not write it to say on what project you're interested. Be specific about your questions and clear on the email subject. For example, do not write an email with the subject "GSoC student interested in the ND images projects". Such email is likely be ignored. Instead, show you are already working on the topic, and email "Problem implementing morphological operators with bitpacked ND images".<br />
*:* It is good to ask advice on how to solve something you can't but you must show some work done. Remember, we are mentors and not your boss. Read [http://www.catb.org/esr/faqs/smart-questions.html How to ask questions the smart way]:<br />
*:*: <blockquote cite="http://www.catb.org/esr/faqs/smart-questions.html">''Prepare your question. Think it through. Hasty-sounding questions get hasty answers, or none at all. The more you do to demonstrate that having put thought and effort into solving your problem before seeking help, the more likely you are to actually get help.''</blockquote><br />
*:* It can be difficult at the beginning to think on something to do. This is nature of free and open source software development. You will need to break the mental barrier that prevents you from thinking on what can be done. Once you do that, you will have no lack of ideas for what to do next.<br />
*:* Use Octave. Eventually you will come accross somethings that does not work the way you like. Fix that. Or you will come accross a missing function. Implement it. It may be a difficult problem (they usually are) but while solving that problem you may find other missing functions (). Implemenent and contribute those to Octave.<br />
*:* Take a look at the [[Short projects]] for something that may be simple to start with.<br />
== Find Something That Interests You == <br />
*: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
*: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on the mailing list and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
== Prepare Your Proposal With Us ==<br />
*: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
== Complete Your Application ==<br />
*: Fill out our '''''public''''' application template.<br />
*:* This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
*:* You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
*: Fill out our '''''private''''' application template.<br />
*:* This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
*:* Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn On Your Own ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
*: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
*: 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.<br />
*: If you've ever done a {{Codeline|configure && make && make install}} series of commands, you have already used the GNU build system.<br />
*: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.''' You will be able to find instructions how to it on this wiki, and the manual. Linux is arguably the easiest system to work on.<br />
*:* [[Building_for_Linux_systems]]<br />
*:* [[Building]]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Building-the-Development-Sources.html Octave Manual on Building the Development Sources]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Installation.html Octave Manual on Installing Octave]<br />
* '''The Version Control System'''<br />
*: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
*: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
*: You will be expected to follow the same procedures as other contributors and core developers.<br />
*: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
*: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
*: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
*: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
*: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
*: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
*: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
*: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
*: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
*: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
*: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
*: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
*: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
*: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
*: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Summary table ==<br />
<br />
{| class="wikitable sortable" style="text-align: center; width:99%"<br />
|-<br />
!Title<br />
!Mentor<br />
!co-Mentors<br />
!Class<br />
!New?<br />
!Difficulty<br />
!Last active<br />
|-<br />
! <br />!! !! !! !! !! !!<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Make_specfuns_special_again | Make specfuns special again]] || Marco Caliari || Colin Macdonald || Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#ode15s_:_Matlab_Compatible_DAE_solver | ode15s : Matlab Compatible DAE solver]] || Carlo de Falco || Marco Caliari, Jacopo Corno, Sebastian Schöps || Numerical || No || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_logm.2C_sqrtm.2C_funm | Improve logm, sqrtm, funm]] || Jordi Gutiérrez Hermoso || Marco Caliari, Mudit Sharma || Numerical || [https://github.com/RickOne16/matrix No] || Hard || Independent devs 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_iterative_methods_for_sparse_linear_systems | Improve iterative methods for sparse linear systems]] || Marco Caliari || Carlo de Falco || Numerical || No || Hard || SOCIS 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#EPA_hydrology_software_suite | EPA hydrology software suite]] || [[User:KaKiLa| KaKiLa]] || ? || Octave Forge || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#TISEAN_package | TISEAN: Nonlinear Time Series Analysis]] || [[User:KaKiLa|KaKiLa]] || ? || Octave Forge || [[TISEAN_package | No]] || Medium || GSoC 2015<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Mapping_or_Geometry_package:_Implement_boolean_operations_on_polygons | Geometry: Boolean operations on Polygons]] || John Swensen || [[User:KaKiLa|KaKiLa]], Philip Neuhuis || Octave Forge || [https://amrkeleg.wordpress.com/ No] || Easy || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Octave_Package_management | Octave Package management]] || Sebastian Schöps || [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Symbolic_package | Symbolic package]] || Colin B. Macdonald || Mike Miller, Abhinav Tripathi || Octave Forge || [https://github.com/cbm755/octsympy Octsympy] || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Interval_package | Interval package]] || [[User:oheim|Oliver Heimlich]] || [[User:Siko1056|Kai T. Ohlhus]] || Octave Forge, Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Using_Python_within_Octave | Pytave project]] || Mike Miller || Colin B. Macdonald, Abhinav Tripathi || Infrastructure || No || Medium || some in GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Jupyter_Integration | Jupyter integration]] || Mike Miller || Colin B. Macdonald || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Chebfun_in_Octave | Chebfun in Octave]] || Colin B. Macdonald || [[User:KaKiLa|KaKiLa]], needs core-Octave mentor/comentor || Infrastructure, Numerical || Yes || Hard || Never<br />
|}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions, primarily in core Octave.<br />
<br />
=== Make specfuns special again ===<br />
<br />
Traditionally, problem solving environments like Octave provide simple interfaces to numerical linear algebra, special function evaluation, root finding, and other tools. Special functions (such as Bessel functions, exponential integrals, LambertW, etc) are expected by users to "just work". But many of Octave's special functions could be improved to improve their numerical accuracy. Generally a user might expect these to be accurate to full 15 digits. Software testing is important to Octave; this project would improve the tests of many special functions, in particular by comparing the output with slow-but-accurate symbolic computations.<br />
<br />
State: some bugs include [https://savannah.gnu.org/bugs/?48307 #48307] (sinc), [https://savannah.gnu.org/bugs/?47738 #47738] (expint), [https://savannah.gnu.org/bugs/?47800 #47800] (gammainc), [https://savannah.gnu.org/bugs/?48036 #48036] (gammaincinv) [https://savannah.gnu.org/bugs/index.php?48316 #48316] (besselj) ''TODO: add others?'' The unmaintained specfun pkg had some poor implementations (e.g., divergence for large x, see [https://github.com/cbm755/octsympy/issues/416].). See also the Symbolic functions in `@double`: these probably should have native double implementations.<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium (mathematics needed, but on the other hand, perhaps little or no C++).<br />
* '''Potential mentors'''<br />
: Marco Caliari, Colin Macdonald, others?<br />
<br />
How to get started: pick a special function, see if it has tests: contribute a patch that adds more tests, e.g., comparing its values to symbolic computations or other highly accurate solutions<br />
<br />
=== ode15s : Matlab Compatible DAE solver ===<br />
<br />
An initial implementation of a Matlab compatible ode15{s,i} solver,<br />
based on [http://computation.llnl.gov/projects/sundials SUNDIALS], <br />
was done by Francesco Faccio during<br />
GSOC 2016.<br />
The blog describing the work is [http://gsoc2016ode15s.blogspot.it/ here].<br />
The resulting code has been pushed into the main Octave repository in the development branch and<br />
consists mainly of the following three files<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/libinterp/dldfcn/__ode15__.cc __ode15__.cc],<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15i.m ode15i.m] and<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15s.m ode15s.m].<br />
The list of outsanding tracker tickets concerning this implementation can be found <br />
[https://savannah.gnu.org/search/?Search=Search&words=ode15&type_of_search=bugs&only_group_id=1925&exact=1&max_rows=25#options here]<br />
<br />
Possible useful improvements that could be done in a new project include:<br />
<br />
* Implement a better funtion for selecting consistent initial conditions compatible with Matlab's decic.m. The algorithm to use is described [http://faculty.smu.edu/shampine/cic.pdf here]<br />
<br />
* make ode15{i,s} with datatypes other than double<br />
<br />
* improve interpolation at intermediate time steps.<br />
<br />
* general code profiling and optimization <br />
<br />
Other tasks, not strictly connected to ode15{i,s} but closely related that could be added <br />
to a possible project plan would be improving documentation and tests in odepkg and removing <br />
overlaps with the documentation in core Octave.<br />
<br />
<br />
* '''Required skills'''<br />
: C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentors'''<br />
: Francesco Faccio, Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
* '''Required skills'''<br />
: Read and Write both C++ and Octave code, find and read research papers, research experience in numerical analysis, familiarity with analysis of algorithms.<br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentors'''<br />
: Jordi Gutiérrez Hermoso<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). The description of some of them (pcr, qmr) and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision and a synchronization of the codes, starting from the project [http://planet.octave.org/#tag:blogger.com,1999:blog-1297699247151766814.post-8054019978706480250 SOCIS2016], whose latest patch, still to be included, is [https://savannah.gnu.org/patch/?9108 here].<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), bicgstabl (general matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available [www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf here]<br />
<br />
* '''Required skills'''<br />
: numerical linear algebra, m-file programming.<br />
* '''Difficulty'''<br />
: Maybe hard the mathematical part, medium the programming part.<br />
* '''Mentor'''<br />
: Marco Caliari<br />
<br />
=== Chebfun in Octave ===<br />
<br />
[https://chebfun.org Chebfun] is a mathematics and software project for "numerical computing with functions". Basically it approximates functions to machine precision accuracy (10<sup>-15</sup>) using piecewise Chebyshev polynomial interpolants. Operations on those functions (arithmetic, derivatives, root-finding, etc) are then overloaded and return new interpolating polynomials, which are themselves proxies for the actual solution.<br />
<br />
Chebfun makes extensive use of classdef classes, and is one of the largest Free Software projects to do so. Unfortunately it currently only works in Matlab. This project seeks to (1) improve Octave's classdef support and (2) tweak Chebfun to work under Octave, for example, removing undocumented classdef features. The final goal is to have at least basic Chebfun features working on Octave. An additional goal would be making "pkg install chebfun.zip" work in Octave.<br />
<br />
This project is important for both technical reasons (to improve Octave's classdef support) and ethical reasons (to allow Chebfun to run without proprietary software).<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, C++, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium to Hard (probably requires a deep dive into how Octave supports OO).<br />
* '''Potential mentors'''<br />
: Colin B. Macdonald, [[User:KaKiLa|KaKiLa]], Marco Caliari (?), Mike Miller (?), Carnë Draug (?), someone from Chebfun team (?).<br />
<br />
How to get started: learn about Chebfun, browse Octave's bug list for classdef-related bugs, play with other classdef projects (Pytave, https://github.com/cbm755/octsympy/issues/545)<br />
<br />
== Adding functionality to Forge packages ==<br />
=== EPA hydrology software suite ===<br />
Create native interfaces to the EPA software suites.<br />
<br />
Starting points<br />
* [https://forja.cica.es/projects/epanet-octave/ epanet-octave].<br />
* [https://github.com/OpenWaterAnalytics/ Open Water Analytics]<br />
<br />
==== SWMM ====<br />
** [https://www.epa.gov/water-research/storm-water-management-model-swmm Official page]<br />
** Check work done in [https://github.com/water-systems/MatSWMM MatSWMM] [http://digital.csic.es/bitstream/10261/132982/1/MatSWMM.pdf article]<br />
<br />
====EPANET====<br />
** [https://www.epa.gov/water-research/epanet Official page]<br />
<br />
====Required skills====<br />
: m-file scripting, C, C++, API knowledge, file I/O, classdef (optional). <br />
<br />
====Difficulty====<br />
: easy/medium<br />
<br />
====Mentor====<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an Octave Forge package, as was done for the Control package.<br />
[[TISEAN_package | A lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There are missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
* '''Required skills'''<br />
: m-file scripting, C, C++, and FORTRAN API knowledge. <br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. The Symbolic package requires communication between Octave and Python. Recently, a GSoC2016 project successfully re-implemented this communication using the new [https://bitbucket.org/mtmiller/pytave Pytave tool].<br />
<br />
This project proposes to go further: instead of using Pytave only for the communication layer, we'll use it throughout the Symbolic project. For example, we might make "@sym" a subclass of "@pyobject". We also could stop using the "python_cmd" interface and use Pytave directly from methods. The main goal was already mentioned: to expose the *full functionality* of SymPy. For example, we would allow OO-style method calls such as "f.diff(x)" instead of "diff(f, x)".<br />
<br />
* '''Required skills'''<br />
: OO-programming with m-files, Python, and possibly C/C++ for improving Pytave (if needed).<br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentors and/or other team members'''<br />
: Colin B. Macdonald, Mike Miller, Abhinav Tripathi<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. Potential projects:<br />
* Make the package support N-dimensional arrays, this requires less knowledge of interval arithmetic but can be a rather exhaustive job since it affects most function files in the package<br />
* Implement missing algorithms (as m-files)—difficulty and whether knowledge in interval analysis is required depends on the particular function. Of course, you may use papers which present such algorithms.<br />
* Improve existing algorithms (support more options for plotting, support more options for optimizers, increase accuracy, …)<br />
* Integrate functions from VERSOFT [http://uivtx.cs.cas.cz/~rohn/matlab/] in the package (some work has already been done and current progress is tracked in [[Interval_package#VERSOFT]]). This basically involves conversion of the documentation into Texinfo format, use Octave coding guidelines [https://www.gnu.org/software/octave/doc/v4.0.0/Octave-Sources-_0028m_002dfiles_0029.html] and to make sure that any called functions are available in the interval package. VERSOFT is originally based on INTLAB, a proprietary Octave package. Some functions may be missing. Also, the interval package doesn't support complex numbers, so it might not be possible to migrate some functions.<br />
* List more interesting use cases of interval arithmetic in the package's manual [https://octave.sourceforge.io/interval/package_doc/Examples.html]<br />
<br />
* '''Required skills'''<br />
: m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement).<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Mentor and co-mentor'''<br />
: [[User:oheim|Oliver Heimlich]], [[User:Siko1056|Kai T. Ohlhus]]<br />
<br />
=== Mapping or Geometry package: Implement boolean operations on polygons ===<br />
<br />
The goal is to implement a Matlab-compatible set of boolean operations and supporting function for acting on polygons. These include the standard set of potential operations such as union/OR, intersection/AND, difference/subtraction, and exclusiveor/XOR.<br />
There is already an octave-forge package that implements a large part of this (the [http://octave.sourceforge.net/octclip/index.html octclip package]); however that does not do XOR; processing polygons with holes could be done better; and maintainability is hampered because all code comments etc. are in Spanish. Other than that, octclip performs fine.<br />
<br />
There are a variety of existing polygon libraries that implement much of the functionality and thus this would be incorporating the library into GNU Octave. The libraries with acceptable licenses are [http://www.angusj.com/delphi/clipper.php ClipperLib], [http://www.boost.org/doc/libs/1_60_0/libs/polygon/doc/index.htm Boost::Polygon], [https://github.com/boostorg/geometry Boost::Geometry], or [http://boolean.klaasholwerda.nl/bool.html kbool]. This would include implementing the following functions: polybool, ispolycw, poly2ccw, poly2cw, poly2fv, polyjoin, and polysplit. A partial implementation with ClipperLib and GPC can be found [https://sites.google.com/site/ulfgri/numerical/polybool here].<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++; C; familiarity with boolean logic; polygons, windings, and geometry<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Potential mentor'''<br />
: John Swensen<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
== Infrastructure ==<br />
<br />
=== Jupyter Integration ===<br />
<br />
[http://jupyter.org Jupyter Notebook] is a web-based worksheet interface for computing. There is a [https://github.com/Calysto/octave_kernel Octave kernel for Jupyter]. This project seeks to improve that kernel to make Octave a first-class experience within the Jupyter Notebook.<br />
<br />
* '''Mentors'''<br />
: Colin B. Macdonald, Mike Miller, others?<br />
<br />
<br />
=== Using Python within Octave ===<br />
<br />
[https://bitbucket.org/mtmiller/pytave Pytave] allows one to call Python functions and interact with Python objects from within Octave .m file code and from the Octave command line interface. Ideally, Pytave will not be a separate project, but rather a core feature of Octave. This project aims to improve Pytave with the goal of merging the code into the core Octave code base. <br />
<br />
Based on a previous summer project related to Pytave, this work will consist of fast-paced collaborative software development based on tackling the [https://bitbucket.org/mtmiller/pytave/issues?status=new&status=open pytave issue list]. You would also be expected to participate in software design decisions and discussion, as well as improve documentation, doctests and unit tests. As an example of the sorts of decision decisions being made, note that Octave indexes from 1 whereas Python typically indexes from 0; in which cases is it appropriate to make this transparent to the user?<br />
<br />
* '''Mentors'''<br />
: Mike Miller, Colin B. Macdonald, Abhinav Tripathi, others?<br />
<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* install from URLs<br />
* install and update from repositories (hg and git)<br />
* automatic handling of dependencies<br />
* easily load, update or check specific package versions<br />
* management of tests and demos in C++ sources of packages<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* support for multiple version packages<br />
* support for multiple Octave installs<br />
* support for system-wide and user installed packages<br />
<br />
The main objective of this project is to make {{codeline|pkg}} more user friendly and to make it a tool to foster third party participation in Octave.<br />
{{codeline|pkg}} needs to be more flexible and intelligent when dealing with packages, different verisons and different sources, as well as options on how to build and install the package.<br />
There are also advance features of pkg that are useful for testing packages. However, the current {{codeline|pkg}} also performs some maintenance functions which it probably should not.<br />
Instead a package for developers should be created with such tools.<br />
<br />
To do this enhacenment effectively, a refactoring of the current {{codeline|pkg}} code will be needed.<br />
[https://bitbucket.org/carandraug/octave/commits/branch/pkg This job was started once], but due to diverging and growing specifications, it stalled. <br />
In this project we will focus on the most needed features, keeping the requirements to a minimum. <br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
* '''Minimum requirements'''<br />
: Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco, Sebastian Schöps<br />
<br />
=== Command line suggestion feature ===<br />
<br />
Currently Octave has no mechanism for suggesting corrections to typographic errors on the command line. An autocomplete/suggestion function is provided (using the double-TAB shortcut), but recent discussions have indicated a desire for a more proactive measure to catch user error. Potential applicants are referred to bug {{bug|46881}} regarding the usage of grey vs. gray. <br />
<br />
Suggested improvements are:<br />
* provide one or more suggested corrections to the user when a command line entry produces an error.<br />
* recognition and suggested correction for apparent syntax errors<br />
* function suggestion(s) when a 'close' match is found (close remains to be defined)<br />
* multiple suggestions if more than one option seems likely, along with a user-friendly method of selecting the appropriate choice.<br />
* user selectable option to disable and/or customize the suggestion behavior<br />
* correct operation, or graceful degradation, whether Octave is run in GUI or command-line mode. <br />
<br />
As mentioned in the bug {{bug|46881}} discussion, this project has little-to-no relation to m-code compatibility. As such, emulation of the behavior of other software is not required, nor even necessarily desired. Octave is free to implement as simple or complex a solution to this feature request as is necessary to provide the best experience to the user. There may be tools, features, or code from other license-compatible projects that can be of use here, and the applicant would be encouraged to identify and leverage such resources as appropriate. <br />
<br />
* '''Minimum requirements'''<br />
: TBD<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: Undetermined<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
* '''Required skills'''<br />
: m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++ and C since most libraries are written in those languages.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
<br />
<br />
<br />
<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=9940Summer of Code - Getting Started2017-03-09T17:21:36Z<p>Cdf: /* ode15s : Matlab Compatible DAE solver */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://summerofcode.withgoogle.com Google] and [http://sophia.estec.esa.int/socis ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
== Help Us Get To Know You == <br />
*: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
*:* '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
*:* '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, answer questions from users, show us that you are motivated, and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Do not wait for us to tell you what to do'''<br />
*: You should be doing something that interests you, and should not need us to tell you what to do. Similarly, you shouldn't ask us what to do either.<br />
*:* When you email the list and mentors, do not write it to say on what project you're interested. Be specific about your questions and clear on the email subject. For example, do not write an email with the subject "GSoC student interested in the ND images projects". Such email is likely be ignored. Instead, show you are already working on the topic, and email "Problem implementing morphological operators with bitpacked ND images".<br />
*:* It is good to ask advice on how to solve something you can't but you must show some work done. Remember, we are mentors and not your boss. Read [http://www.catb.org/esr/faqs/smart-questions.html How to ask questions the smart way]:<br />
*:*: <blockquote cite="http://www.catb.org/esr/faqs/smart-questions.html">''Prepare your question. Think it through. Hasty-sounding questions get hasty answers, or none at all. The more you do to demonstrate that having put thought and effort into solving your problem before seeking help, the more likely you are to actually get help.''</blockquote><br />
*:* It can be difficult at the beginning to think on something to do. This is nature of free and open source software development. You will need to break the mental barrier that prevents you from thinking on what can be done. Once you do that, you will have no lack of ideas for what to do next.<br />
*:* Use Octave. Eventually you will come accross somethings that does not work the way you like. Fix that. Or you will come accross a missing function. Implement it. It may be a difficult problem (they usually are) but while solving that problem you may find other missing functions (). Implemenent and contribute those to Octave.<br />
*:* Take a look at the [[Short projects]] for something that may be simple to start with.<br />
== Find Something That Interests You == <br />
*: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
*: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on the mailing list and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
== Prepare Your Proposal With Us ==<br />
*: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
== Complete Your Application ==<br />
*: Fill out our '''''public''''' application template.<br />
*:* This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
*:* You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
*: Fill out our '''''private''''' application template.<br />
*:* This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
*:* Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn On Your Own ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
*: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
*: 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.<br />
*: If you've ever done a {{Codeline|configure && make && make install}} series of commands, you have already used the GNU build system.<br />
*: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.''' You will be able to find instructions how to it on this wiki, and the manual. Linux is arguably the easiest system to work on.<br />
*:* [[Building_for_Linux_systems]]<br />
*:* [[Building]]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Building-the-Development-Sources.html Octave Manual on Building the Development Sources]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Installation.html Octave Manual on Installing Octave]<br />
* '''The Version Control System'''<br />
*: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
*: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
*: You will be expected to follow the same procedures as other contributors and core developers.<br />
*: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
*: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
*: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
*: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
*: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
*: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
*: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
*: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
*: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
*: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
*: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
*: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
*: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
*: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
*: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Summary table ==<br />
<br />
{| class="wikitable sortable" style="text-align: center; width:99%"<br />
|-<br />
!Title<br />
!Mentor<br />
!co-Mentors<br />
!Class<br />
!New?<br />
!Difficulty<br />
!Last active<br />
|-<br />
! <br />!! !! !! !! !! !!<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Make_specfuns_special_again | Make specfuns special again]] || Marco Caliari || Colin Macdonald || Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#ode15s_:_Matlab_Compatible_DAE_solver | ode15s : Matlab Compatible DAE solver]] || Carlo de Falco || Marco Caliari, Jacopo Corno, Sebastian Schöps || Numerical || No || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_logm.2C_sqrtm.2C_funm | Improve logm, sqrtm, funm]] || Jordi Gutiérrez Hermoso || Marco Caliari, Mudit Sharma || Numerical || [https://github.com/RickOne16/matrix No] || Hard || Independent devs 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_iterative_methods_for_sparse_linear_systems | Improve iterative methods for sparse linear systems]] || Marco Caliari || Carlo de Falco || Numerical || No || Hard || SOCIS 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#EPA_hydrology_software_suite | EPA hydrology software suite]] || [[User:KaKiLa| KaKiLa]] || ? || Octave Forge || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#TISEAN_package | TISEAN: Nonlinear Time Series Analysis]] || [[User:KaKiLa|KaKiLa]] || ? || Octave Forge || [[TISEAN_package | No]] || Medium || GSoC 2015<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Mapping_or_Geometry_package:_Implement_boolean_operations_on_polygons | Geometry: Boolean operations on Polygons]] || John Swensen || [[User:KaKiLa|KaKiLa]], Philip Neuhuis || Octave Forge || [https://amrkeleg.wordpress.com/ No] || Easy || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Octave_Package_management | Octave Package management]] || Sebastian Schöps || [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Symbolic_package | Symbolic package]] || Colin B. Macdonald || Mike Miller, Abhinav Tripathi || Octave Forge || [https://github.com/cbm755/octsympy Octsympy] || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Interval_package | Interval package]] || [[User:oheim|Oliver Heimlich]] || [[User:Siko1056|Kai T. Ohlhus]] || Octave Forge, Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Using_Python_within_Octave | Pytave project]] || Mike Miller || Colin B. Macdonald, Abhinav Tripathi || Infrastructure || No || Medium || some in GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Jupyter_Integration | Jupyter integration]] || Mike Miller || Colin B. Macdonald || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Chebfun_in_Octave | Chebfun in Octave]] || Colin B. Macdonald || [[User:KaKiLa|KaKiLa]], needs core-Octave mentor/comentor || Infrastructure, Numerical || Yes || Hard || Never<br />
|}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions, primarily in core Octave.<br />
<br />
=== Make specfuns special again ===<br />
<br />
Traditionally, problem solving environments like Octave provide simple interfaces to numerical linear algebra, special function evaluation, root finding, and other tools. Special functions (such as Bessel functions, exponential integrals, LambertW, etc) are expected by users to "just work". But many of Octave's special functions could be improved to improve their numerical accuracy. Generally a user might expect these to be accurate to full 15 digits. Software testing is important to Octave; this project would improve the tests of many special functions, in particular by comparing the output with slow-but-accurate symbolic computations.<br />
<br />
State: some bugs include [https://savannah.gnu.org/bugs/?48307 #48307] (sinc), [https://savannah.gnu.org/bugs/?47738 #47738] (expint), [https://savannah.gnu.org/bugs/?47800 #47800] (gammainc), [https://savannah.gnu.org/bugs/?48036 #48036] (gammaincinv) [https://savannah.gnu.org/bugs/index.php?48316 #48316] (besselj) ''TODO: add others?'' The unmaintained specfun pkg had some poor implementations (e.g., divergence for large x, see [https://github.com/cbm755/octsympy/issues/416].). See also the Symbolic functions in `@double`: these probably should have native double implementations.<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium (mathematics needed, but on the other hand, perhaps little or no C++).<br />
* '''Potential mentors'''<br />
: Marco Caliari, Colin Macdonald, others?<br />
<br />
How to get started: pick a special function, see if it has tests: contribute a patch that adds more tests, e.g., comparing its values to symbolic computations or other highly accurate solutions<br />
<br />
=== ode15s : Matlab Compatible DAE solver ===<br />
<br />
An initial implementation of a Matlab compatible ode15{s,i} solver,<br />
based on [http://computation.llnl.gov/projects/sundials SUNDIALS], <br />
was done by Francesco Faccio during<br />
GSOC 2016.<br />
The blog describing the work is [http://gsoc2016ode15s.blogspot.it/ here].<br />
The resulting code has been pushed into the main Octave repository in the development branch and<br />
consists mainly of the following three files<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/libinterp/dldfcn/__ode15__.cc __ode15__.cc],<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15i.m ode15i.m] and<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15s.m ode15s.m].<br />
Possible useful improvements that could be done in a new project include:<br />
<br />
* Implement a better funtion for selecting consistent initial conditions compatible with Matlab's decic.m. The algorithm to use is described [http://faculty.smu.edu/shampine/cic.pdf here]<br />
<br />
* make ode15{i,s} with datatypes other than double<br />
<br />
* improve interpolation at intermediate time steps.<br />
<br />
* general code profiling and optimization <br />
<br />
Other tasks, not strictly related to ode15{i,s} that could be added to a possible project plan would be improving documentation tests in odepkg and removing overlaps with the documentation in core Octave.<br />
<br />
<br />
* '''Required skills'''<br />
: C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentors'''<br />
: Francesco Faccio, Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
* '''Required skills'''<br />
: Read and Write both C++ and Octave code, find and read research papers, research experience in numerical analysis, familiarity with analysis of algorithms.<br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentors'''<br />
: Jordi Gutiérrez Hermoso<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). The description of some of them (pcr, qmr) and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision and a synchronization of the codes, starting from the project [http://planet.octave.org/#tag:blogger.com,1999:blog-1297699247151766814.post-8054019978706480250 SOCIS2016], whose latest patch, still to be included, is [https://savannah.gnu.org/patch/?9108 here].<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), bicgstabl (general matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available [www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf here]<br />
<br />
* '''Required skills'''<br />
: numerical linear algebra, m-file programming.<br />
* '''Difficulty'''<br />
: Maybe hard the mathematical part, medium the programming part.<br />
* '''Mentor'''<br />
: Marco Caliari<br />
<br />
=== Chebfun in Octave ===<br />
<br />
[https://chebfun.org Chebfun] is a mathematics and software project for "numerical computing with functions". Basically it approximates functions to machine precision accuracy (10<sup>-15</sup>) using piecewise Chebyshev polynomial interpolants. Operations on those functions (arithmetic, derivatives, root-finding, etc) are then overloaded and return new interpolating polynomials, which are themselves proxies for the actual solution.<br />
<br />
Chebfun makes extensive use of classdef classes, and is one of the largest Free Software projects to do so. Unfortunately it currently only works in Matlab. This project seeks to (1) improve Octave's classdef support and (2) tweak Chebfun to work under Octave, for example, removing undocumented classdef features. The final goal is to have at least basic Chebfun features working on Octave. An additional goal would be making "pkg install chebfun.zip" work in Octave.<br />
<br />
This project is important for both technical reasons (to improve Octave's classdef support) and ethical reasons (to allow Chebfun to run without proprietary software).<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, C++, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium to Hard (probably requires a deep dive into how Octave supports OO).<br />
* '''Potential mentors'''<br />
: Colin B. Macdonald, [[User:KaKiLa|KaKiLa]], Marco Caliari (?), Mike Miller (?), Carnë Draug (?), someone from Chebfun team (?).<br />
<br />
How to get started: learn about Chebfun, browse Octave's bug list for classdef-related bugs, play with other classdef projects (Pytave, https://github.com/cbm755/octsympy/issues/545)<br />
<br />
== Adding functionality to Forge packages ==<br />
=== EPA hydrology software suite ===<br />
Create native interfaces to the EPA software suites.<br />
<br />
Starting points<br />
* [https://forja.cica.es/projects/epanet-octave/ epanet-octave].<br />
* [https://github.com/OpenWaterAnalytics/ Open Water Analytics]<br />
<br />
==== SWMM ====<br />
** [https://www.epa.gov/water-research/storm-water-management-model-swmm Official page]<br />
** Check work done in [https://github.com/water-systems/MatSWMM MatSWMM] [http://digital.csic.es/bitstream/10261/132982/1/MatSWMM.pdf article]<br />
<br />
====EPANET====<br />
** [https://www.epa.gov/water-research/epanet Official page]<br />
<br />
====Required skills====<br />
: m-file scripting, C, C++, API knowledge, file I/O, classdef (optional). <br />
<br />
====Difficulty====<br />
: easy/medium<br />
<br />
====Mentor====<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an Octave Forge package, as was done for the Control package.<br />
[[TISEAN_package | A lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There are missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
* '''Required skills'''<br />
: m-file scripting, C, C++, and FORTRAN API knowledge. <br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. The Symbolic package requires communication between Octave and Python. Recently, a GSoC2016 project successfully re-implemented this communication using the new [https://bitbucket.org/mtmiller/pytave Pytave tool].<br />
<br />
This project proposes to go further: instead of using Pytave only for the communication layer, we'll use it throughout the Symbolic project. For example, we might make "@sym" a subclass of "@pyobject". We also could stop using the "python_cmd" interface and use Pytave directly from methods. The main goal was already mentioned: to expose the *full functionality* of SymPy. For example, we would allow OO-style method calls such as "f.diff(x)" instead of "diff(f, x)".<br />
<br />
* '''Required skills'''<br />
: OO-programming with m-files, Python, and possibly C/C++ for improving Pytave (if needed).<br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentors and/or other team members'''<br />
: Colin B. Macdonald, Mike Miller, Abhinav Tripathi<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. Potential projects:<br />
* Make the package support N-dimensional arrays, this requires less knowledge of interval arithmetic but can be a rather exhaustive job since it affects most function files in the package<br />
* Implement missing algorithms (as m-files)—difficulty and whether knowledge in interval analysis is required depends on the particular function. Of course, you may use papers which present such algorithms.<br />
* Improve existing algorithms (support more options for plotting, support more options for optimizers, increase accuracy, …)<br />
* Integrate functions from VERSOFT [http://uivtx.cs.cas.cz/~rohn/matlab/] in the package (some work has already been done and current progress is tracked in [[Interval_package#VERSOFT]]). This basically involves conversion of the documentation into Texinfo format, use Octave coding guidelines [https://www.gnu.org/software/octave/doc/v4.0.0/Octave-Sources-_0028m_002dfiles_0029.html] and to make sure that any called functions are available in the interval package. VERSOFT is originally based on INTLAB, a proprietary Octave package. Some functions may be missing. Also, the interval package doesn't support complex numbers, so it might not be possible to migrate some functions.<br />
* List more interesting use cases of interval arithmetic in the package's manual [https://octave.sourceforge.io/interval/package_doc/Examples.html]<br />
<br />
* '''Required skills'''<br />
: m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement).<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Mentor and co-mentor'''<br />
: [[User:oheim|Oliver Heimlich]], [[User:Siko1056|Kai T. Ohlhus]]<br />
<br />
=== Mapping or Geometry package: Implement boolean operations on polygons ===<br />
<br />
The goal is to implement a Matlab-compatible set of boolean operations and supporting function for acting on polygons. These include the standard set of potential operations such as union/OR, intersection/AND, difference/subtraction, and exclusiveor/XOR.<br />
There is already an octave-forge package that implements a large part of this (the [http://octave.sourceforge.net/octclip/index.html octclip package]); however that does not do XOR; processing polygons with holes could be done better; and maintainability is hampered because all code comments etc. are in Spanish. Other than that, octclip performs fine.<br />
<br />
There are a variety of existing polygon libraries that implement much of the functionality and thus this would be incorporating the library into GNU Octave. The libraries with acceptable licenses are [http://www.angusj.com/delphi/clipper.php ClipperLib], [http://www.boost.org/doc/libs/1_60_0/libs/polygon/doc/index.htm Boost::Polygon], [https://github.com/boostorg/geometry Boost::Geometry], or [http://boolean.klaasholwerda.nl/bool.html kbool]. This would include implementing the following functions: polybool, ispolycw, poly2ccw, poly2cw, poly2fv, polyjoin, and polysplit. A partial implementation with ClipperLib and GPC can be found [https://sites.google.com/site/ulfgri/numerical/polybool here].<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++; C; familiarity with boolean logic; polygons, windings, and geometry<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Potential mentor'''<br />
: John Swensen<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
== Infrastructure ==<br />
<br />
=== Jupyter Integration ===<br />
<br />
[http://jupyter.org Jupyter Notebook] is a web-based worksheet interface for computing. There is a [https://github.com/Calysto/octave_kernel Octave kernel for Jupyter]. This project seeks to improve that kernel to make Octave a first-class experience within the Jupyter Notebook.<br />
<br />
* '''Mentors'''<br />
: Colin B. Macdonald, Mike Miller, others?<br />
<br />
<br />
=== Using Python within Octave ===<br />
<br />
[https://bitbucket.org/mtmiller/pytave Pytave] allows one to call Python functions and interact with Python objects from within Octave .m file code and from the Octave command line interface. Ideally, Pytave will not be a separate project, but rather a core feature of Octave. This project aims to improve Pytave with the goal of merging the code into the core Octave code base. <br />
<br />
Based on a previous summer project related to Pytave, this work will consist of fast-paced collaborative software development based on tackling the [https://bitbucket.org/mtmiller/pytave/issues?status=new&status=open pytave issue list]. You would also be expected to participate in software design decisions and discussion, as well as improve documentation, doctests and unit tests. As an example of the sorts of decision decisions being made, note that Octave indexes from 1 whereas Python typically indexes from 0; in which cases is it appropriate to make this transparent to the user?<br />
<br />
* '''Mentors'''<br />
: Mike Miller, Colin B. Macdonald, Abhinav Tripathi, others?<br />
<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* install from URLs<br />
* install and update from repositories (hg and git)<br />
* automatic handling of dependencies<br />
* easily load, update or check specific package versions<br />
* management of tests and demos in C++ sources of packages<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* support for multiple version packages<br />
* support for multiple Octave installs<br />
* support for system-wide and user installed packages<br />
<br />
The main objective of this project is to make {{codeline|pkg}} more user friendly and to make it a tool to foster third party participation in Octave.<br />
{{codeline|pkg}} needs to be more flexible and intelligent when dealing with packages, different verisons and different sources, as well as options on how to build and install the package.<br />
There are also advance features of pkg that are useful for testing packages. However, the current {{codeline|pkg}} also performs some maintenance functions which it probably should not.<br />
Instead a package for developers should be created with such tools.<br />
<br />
To do this enhacenment effectively, a refactoring of the current {{codeline|pkg}} code will be needed.<br />
[https://bitbucket.org/carandraug/octave/commits/branch/pkg This job was started once], but due to diverging and growing specifications, it stalled. <br />
In this project we will focus on the most needed features, keeping the requirements to a minimum. <br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
* '''Minimum requirements'''<br />
: Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco, Sebastian Schöps<br />
<br />
=== Command line suggestion feature ===<br />
<br />
Currently Octave has no mechanism for suggesting corrections to typographic errors on the command line. An autocomplete/suggestion function is provided (using the double-TAB shortcut), but recent discussions have indicated a desire for a more proactive measure to catch user error. Potential applicants are referred to bug {{bug|46881}} regarding the usage of grey vs. gray. <br />
<br />
Suggested improvements are:<br />
* provide one or more suggested corrections to the user when a command line entry produces an error.<br />
* recognition and suggested correction for apparent syntax errors<br />
* function suggestion(s) when a 'close' match is found (close remains to be defined)<br />
* multiple suggestions if more than one option seems likely, along with a user-friendly method of selecting the appropriate choice.<br />
* user selectable option to disable and/or customize the suggestion behavior<br />
* correct operation, or graceful degradation, whether Octave is run in GUI or command-line mode. <br />
<br />
As mentioned in the bug {{bug|46881}} discussion, this project has little-to-no relation to m-code compatibility. As such, emulation of the behavior of other software is not required, nor even necessarily desired. Octave is free to implement as simple or complex a solution to this feature request as is necessary to provide the best experience to the user. There may be tools, features, or code from other license-compatible projects that can be of use here, and the applicant would be encouraged to identify and leverage such resources as appropriate. <br />
<br />
* '''Minimum requirements'''<br />
: TBD<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: Undetermined<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
* '''Required skills'''<br />
: m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++ and C since most libraries are written in those languages.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
<br />
<br />
<br />
<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=9939Summer of Code - Getting Started2017-03-09T17:11:30Z<p>Cdf: /* ode15s : Matlab Compatible DAE solver */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://summerofcode.withgoogle.com Google] and [http://sophia.estec.esa.int/socis ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
== Help Us Get To Know You == <br />
*: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
*:* '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
*:* '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, answer questions from users, show us that you are motivated, and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Do not wait for us to tell you what to do'''<br />
*: You should be doing something that interests you, and should not need us to tell you what to do. Similarly, you shouldn't ask us what to do either.<br />
*:* When you email the list and mentors, do not write it to say on what project you're interested. Be specific about your questions and clear on the email subject. For example, do not write an email with the subject "GSoC student interested in the ND images projects". Such email is likely be ignored. Instead, show you are already working on the topic, and email "Problem implementing morphological operators with bitpacked ND images".<br />
*:* It is good to ask advice on how to solve something you can't but you must show some work done. Remember, we are mentors and not your boss. Read [http://www.catb.org/esr/faqs/smart-questions.html How to ask questions the smart way]:<br />
*:*: <blockquote cite="http://www.catb.org/esr/faqs/smart-questions.html">''Prepare your question. Think it through. Hasty-sounding questions get hasty answers, or none at all. The more you do to demonstrate that having put thought and effort into solving your problem before seeking help, the more likely you are to actually get help.''</blockquote><br />
*:* It can be difficult at the beginning to think on something to do. This is nature of free and open source software development. You will need to break the mental barrier that prevents you from thinking on what can be done. Once you do that, you will have no lack of ideas for what to do next.<br />
*:* Use Octave. Eventually you will come accross somethings that does not work the way you like. Fix that. Or you will come accross a missing function. Implement it. It may be a difficult problem (they usually are) but while solving that problem you may find other missing functions (). Implemenent and contribute those to Octave.<br />
*:* Take a look at the [[Short projects]] for something that may be simple to start with.<br />
== Find Something That Interests You == <br />
*: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
*: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on the mailing list and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
== Prepare Your Proposal With Us ==<br />
*: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
== Complete Your Application ==<br />
*: Fill out our '''''public''''' application template.<br />
*:* This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
*:* You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
*: Fill out our '''''private''''' application template.<br />
*:* This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
*:* Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn On Your Own ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
*: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
*: 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.<br />
*: If you've ever done a {{Codeline|configure && make && make install}} series of commands, you have already used the GNU build system.<br />
*: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.''' You will be able to find instructions how to it on this wiki, and the manual. Linux is arguably the easiest system to work on.<br />
*:* [[Building_for_Linux_systems]]<br />
*:* [[Building]]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Building-the-Development-Sources.html Octave Manual on Building the Development Sources]<br />
*:* [https://www.gnu.org/software/octave/doc/interpreter/Installation.html Octave Manual on Installing Octave]<br />
* '''The Version Control System'''<br />
*: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
*: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
*: You will be expected to follow the same procedures as other contributors and core developers.<br />
*: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
*: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
*: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
*: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
*: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
*: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
*: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
*: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
*: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
*: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
*: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
*: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
*: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
*: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
*: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Summary table ==<br />
<br />
{| class="wikitable sortable" style="text-align: center; width:99%"<br />
|-<br />
!Title<br />
!Mentor<br />
!co-Mentors<br />
!Class<br />
!New?<br />
!Difficulty<br />
!Last active<br />
|-<br />
! <br />!! !! !! !! !! !!<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Make_specfuns_special_again | Make specfuns special again]] || Marco Caliari || Colin Macdonald || Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#ode15s_:_Matlab_Compatible_DAE_solver | ode15s : Matlab Compatible DAE solver]] || Carlo de Falco || Marco Caliari, Jacopo Corno, Sebastian Schöps || Numerical || No || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_logm.2C_sqrtm.2C_funm | Improve logm, sqrtm, funm]] || Jordi Gutiérrez Hermoso || Marco Caliari, Mudit Sharma || Numerical || [https://github.com/RickOne16/matrix No] || Hard || Independent devs 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Improve_iterative_methods_for_sparse_linear_systems | Improve iterative methods for sparse linear systems]] || Marco Caliari || Carlo de Falco || Numerical || No || Hard || SOCIS 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#EPA_hydrology_software_suite | EPA hydrology software suite]] || [[User:KaKiLa| KaKiLa]] || ? || Octave Forge || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#TISEAN_package | TISEAN: Nonlinear Time Series Analysis]] || [[User:KaKiLa|KaKiLa]] || ? || Octave Forge || [[TISEAN_package | No]] || Medium || GSoC 2015<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Mapping_or_Geometry_package:_Implement_boolean_operations_on_polygons | Geometry: Boolean operations on Polygons]] || John Swensen || [[User:KaKiLa|KaKiLa]], Philip Neuhuis || Octave Forge || [https://amrkeleg.wordpress.com/ No] || Easy || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Octave_Package_management | Octave Package management]] || Sebastian Schöps || [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Symbolic_package | Symbolic package]] || Colin B. Macdonald || Mike Miller, Abhinav Tripathi || Octave Forge || [https://github.com/cbm755/octsympy Octsympy] || Medium || GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Interval_package | Interval package]] || [[User:oheim|Oliver Heimlich]] || [[User:Siko1056|Kai T. Ohlhus]] || Octave Forge, Numerical || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Using_Python_within_Octave | Pytave project]] || Mike Miller || Colin B. Macdonald, Abhinav Tripathi || Infrastructure || No || Medium || some in GSoC 2016<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Jupyter_Integration | Jupyter integration]] || Mike Miller || Colin B. Macdonald || Infrastructure || Yes || Medium || Never<br />
|-<br />
| [[Summer_of_Code_Project_Ideas#Chebfun_in_Octave | Chebfun in Octave]] || Colin B. Macdonald || [[User:KaKiLa|KaKiLa]], needs core-Octave mentor/comentor || Infrastructure, Numerical || Yes || Hard || Never<br />
|}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions, primarily in core Octave.<br />
<br />
=== Make specfuns special again ===<br />
<br />
Traditionally, problem solving environments like Octave provide simple interfaces to numerical linear algebra, special function evaluation, root finding, and other tools. Special functions (such as Bessel functions, exponential integrals, LambertW, etc) are expected by users to "just work". But many of Octave's special functions could be improved to improve their numerical accuracy. Generally a user might expect these to be accurate to full 15 digits. Software testing is important to Octave; this project would improve the tests of many special functions, in particular by comparing the output with slow-but-accurate symbolic computations.<br />
<br />
State: some bugs include [https://savannah.gnu.org/bugs/?48307 #48307] (sinc), [https://savannah.gnu.org/bugs/?47738 #47738] (expint), [https://savannah.gnu.org/bugs/?47800 #47800] (gammainc), [https://savannah.gnu.org/bugs/?48036 #48036] (gammaincinv) [https://savannah.gnu.org/bugs/index.php?48316 #48316] (besselj) ''TODO: add others?'' The unmaintained specfun pkg had some poor implementations (e.g., divergence for large x, see [https://github.com/cbm755/octsympy/issues/416].). See also the Symbolic functions in `@double`: these probably should have native double implementations.<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium (mathematics needed, but on the other hand, perhaps little or no C++).<br />
* '''Potential mentors'''<br />
: Marco Caliari, Colin Macdonald, others?<br />
<br />
How to get started: pick a special function, see if it has tests: contribute a patch that adds more tests, e.g., comparing its values to symbolic computations or other highly accurate solutions<br />
<br />
=== ode15s : Matlab Compatible DAE solver ===<br />
<br />
An initial implementation of a Matlab compatible ode15{s,i} solver,<br />
based on [http://computation.llnl.gov/projects/sundials SUNDIALS], <br />
was done by Francesco Faccio during<br />
GSOC 2016.<br />
The blog describing the work is [http://gsoc2016ode15s.blogspot.it/ here].<br />
The resulting code has been pushed into the main Octave repository in the development branch and<br />
consists mainly of the following three files<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/libinterp/dldfcn/__ode15__.cc __ode15__.cc],<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15i.m ode15i.m] and<br />
[http://hg.savannah.gnu.org/hgweb/octave/file/4890b1c4a6bd/scripts/ode/ode15s.m ode15s.m].<br />
Possible useful improvements that could be done in a new project include:<br />
<br />
* '''Required skills'''<br />
: C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentors'''<br />
: Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
* '''Required skills'''<br />
: Read and Write both C++ and Octave code, find and read research papers, research experience in numerical analysis, familiarity with analysis of algorithms.<br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentors'''<br />
: Jordi Gutiérrez Hermoso<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). The description of some of them (pcr, qmr) and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision and a synchronization of the codes, starting from the project [http://planet.octave.org/#tag:blogger.com,1999:blog-1297699247151766814.post-8054019978706480250 SOCIS2016], whose latest patch, still to be included, is [https://savannah.gnu.org/patch/?9108 here].<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), bicgstabl (general matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available [www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf here]<br />
<br />
* '''Required skills'''<br />
: numerical linear algebra, m-file programming.<br />
* '''Difficulty'''<br />
: Maybe hard the mathematical part, medium the programming part.<br />
* '''Mentor'''<br />
: Marco Caliari<br />
<br />
=== Chebfun in Octave ===<br />
<br />
[https://chebfun.org Chebfun] is a mathematics and software project for "numerical computing with functions". Basically it approximates functions to machine precision accuracy (10<sup>-15</sup>) using piecewise Chebyshev polynomial interpolants. Operations on those functions (arithmetic, derivatives, root-finding, etc) are then overloaded and return new interpolating polynomials, which are themselves proxies for the actual solution.<br />
<br />
Chebfun makes extensive use of classdef classes, and is one of the largest Free Software projects to do so. Unfortunately it currently only works in Matlab. This project seeks to (1) improve Octave's classdef support and (2) tweak Chebfun to work under Octave, for example, removing undocumented classdef features. The final goal is to have at least basic Chebfun features working on Octave. An additional goal would be making "pkg install chebfun.zip" work in Octave.<br />
<br />
This project is important for both technical reasons (to improve Octave's classdef support) and ethical reasons (to allow Chebfun to run without proprietary software).<br />
<br />
* '''Required skills'''<br />
: Octave m-file programming, C++, some familiarity with Approximation Theory (a branch of mathematics).<br />
* '''Difficulty'''<br />
: Medium to Hard (probably requires a deep dive into how Octave supports OO).<br />
* '''Potential mentors'''<br />
: Colin B. Macdonald, [[User:KaKiLa|KaKiLa]], Marco Caliari (?), Mike Miller (?), Carnë Draug (?), someone from Chebfun team (?).<br />
<br />
How to get started: learn about Chebfun, browse Octave's bug list for classdef-related bugs, play with other classdef projects (Pytave, https://github.com/cbm755/octsympy/issues/545)<br />
<br />
== Adding functionality to Forge packages ==<br />
=== EPA hydrology software suite ===<br />
Create native interfaces to the EPA software suites.<br />
<br />
Starting points<br />
* [https://forja.cica.es/projects/epanet-octave/ epanet-octave].<br />
* [https://github.com/OpenWaterAnalytics/ Open Water Analytics]<br />
<br />
==== SWMM ====<br />
** [https://www.epa.gov/water-research/storm-water-management-model-swmm Official page]<br />
** Check work done in [https://github.com/water-systems/MatSWMM MatSWMM] [http://digital.csic.es/bitstream/10261/132982/1/MatSWMM.pdf article]<br />
<br />
====EPANET====<br />
** [https://www.epa.gov/water-research/epanet Official page]<br />
<br />
====Required skills====<br />
: m-file scripting, C, C++, API knowledge, file I/O, classdef (optional). <br />
<br />
====Difficulty====<br />
: easy/medium<br />
<br />
====Mentor====<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an Octave Forge package, as was done for the Control package.<br />
[[TISEAN_package | A lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There are missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
* '''Required skills'''<br />
: m-file scripting, C, C++, and FORTRAN API knowledge. <br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. The Symbolic package requires communication between Octave and Python. Recently, a GSoC2016 project successfully re-implemented this communication using the new [https://bitbucket.org/mtmiller/pytave Pytave tool].<br />
<br />
This project proposes to go further: instead of using Pytave only for the communication layer, we'll use it throughout the Symbolic project. For example, we might make "@sym" a subclass of "@pyobject". We also could stop using the "python_cmd" interface and use Pytave directly from methods. The main goal was already mentioned: to expose the *full functionality* of SymPy. For example, we would allow OO-style method calls such as "f.diff(x)" instead of "diff(f, x)".<br />
<br />
* '''Required skills'''<br />
: OO-programming with m-files, Python, and possibly C/C++ for improving Pytave (if needed).<br />
* '''Difficulty'''<br />
: easy/medium<br />
* '''Mentors and/or other team members'''<br />
: Colin B. Macdonald, Mike Miller, Abhinav Tripathi<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. Potential projects:<br />
* Make the package support N-dimensional arrays, this requires less knowledge of interval arithmetic but can be a rather exhaustive job since it affects most function files in the package<br />
* Implement missing algorithms (as m-files)—difficulty and whether knowledge in interval analysis is required depends on the particular function. Of course, you may use papers which present such algorithms.<br />
* Improve existing algorithms (support more options for plotting, support more options for optimizers, increase accuracy, …)<br />
* Integrate functions from VERSOFT [http://uivtx.cs.cas.cz/~rohn/matlab/] in the package (some work has already been done and current progress is tracked in [[Interval_package#VERSOFT]]). This basically involves conversion of the documentation into Texinfo format, use Octave coding guidelines [https://www.gnu.org/software/octave/doc/v4.0.0/Octave-Sources-_0028m_002dfiles_0029.html] and to make sure that any called functions are available in the interval package. VERSOFT is originally based on INTLAB, a proprietary Octave package. Some functions may be missing. Also, the interval package doesn't support complex numbers, so it might not be possible to migrate some functions.<br />
* List more interesting use cases of interval arithmetic in the package's manual [https://octave.sourceforge.io/interval/package_doc/Examples.html]<br />
<br />
* '''Required skills'''<br />
: m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement).<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Mentor and co-mentor'''<br />
: [[User:oheim|Oliver Heimlich]], [[User:Siko1056|Kai T. Ohlhus]]<br />
<br />
=== Mapping or Geometry package: Implement boolean operations on polygons ===<br />
<br />
The goal is to implement a Matlab-compatible set of boolean operations and supporting function for acting on polygons. These include the standard set of potential operations such as union/OR, intersection/AND, difference/subtraction, and exclusiveor/XOR.<br />
There is already an octave-forge package that implements a large part of this (the [http://octave.sourceforge.net/octclip/index.html octclip package]); however that does not do XOR; processing polygons with holes could be done better; and maintainability is hampered because all code comments etc. are in Spanish. Other than that, octclip performs fine.<br />
<br />
There are a variety of existing polygon libraries that implement much of the functionality and thus this would be incorporating the library into GNU Octave. The libraries with acceptable licenses are [http://www.angusj.com/delphi/clipper.php ClipperLib], [http://www.boost.org/doc/libs/1_60_0/libs/polygon/doc/index.htm Boost::Polygon], [https://github.com/boostorg/geometry Boost::Geometry], or [http://boolean.klaasholwerda.nl/bool.html kbool]. This would include implementing the following functions: polybool, ispolycw, poly2ccw, poly2cw, poly2fv, polyjoin, and polysplit. A partial implementation with ClipperLib and GPC can be found [https://sites.google.com/site/ulfgri/numerical/polybool here].<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++; C; familiarity with boolean logic; polygons, windings, and geometry<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Potential mentor'''<br />
: John Swensen<br />
: [[User:KaKiLa|KaKiLa]]<br />
<br />
== Infrastructure ==<br />
<br />
=== Jupyter Integration ===<br />
<br />
[http://jupyter.org Jupyter Notebook] is a web-based worksheet interface for computing. There is a [https://github.com/Calysto/octave_kernel Octave kernel for Jupyter]. This project seeks to improve that kernel to make Octave a first-class experience within the Jupyter Notebook.<br />
<br />
* '''Mentors'''<br />
: Colin B. Macdonald, Mike Miller, others?<br />
<br />
<br />
=== Using Python within Octave ===<br />
<br />
[https://bitbucket.org/mtmiller/pytave Pytave] allows one to call Python functions and interact with Python objects from within Octave .m file code and from the Octave command line interface. Ideally, Pytave will not be a separate project, but rather a core feature of Octave. This project aims to improve Pytave with the goal of merging the code into the core Octave code base. <br />
<br />
Based on a previous summer project related to Pytave, this work will consist of fast-paced collaborative software development based on tackling the [https://bitbucket.org/mtmiller/pytave/issues?status=new&status=open pytave issue list]. You would also be expected to participate in software design decisions and discussion, as well as improve documentation, doctests and unit tests. As an example of the sorts of decision decisions being made, note that Octave indexes from 1 whereas Python typically indexes from 0; in which cases is it appropriate to make this transparent to the user?<br />
<br />
* '''Mentors'''<br />
: Mike Miller, Colin B. Macdonald, Abhinav Tripathi, others?<br />
<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* install from URLs<br />
* install and update from repositories (hg and git)<br />
* automatic handling of dependencies<br />
* easily load, update or check specific package versions<br />
* management of tests and demos in C++ sources of packages<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* support for multiple version packages<br />
* support for multiple Octave installs<br />
* support for system-wide and user installed packages<br />
<br />
The main objective of this project is to make {{codeline|pkg}} more user friendly and to make it a tool to foster third party participation in Octave.<br />
{{codeline|pkg}} needs to be more flexible and intelligent when dealing with packages, different verisons and different sources, as well as options on how to build and install the package.<br />
There are also advance features of pkg that are useful for testing packages. However, the current {{codeline|pkg}} also performs some maintenance functions which it probably should not.<br />
Instead a package for developers should be created with such tools.<br />
<br />
To do this enhacenment effectively, a refactoring of the current {{codeline|pkg}} code will be needed.<br />
[https://bitbucket.org/carandraug/octave/commits/branch/pkg This job was started once], but due to diverging and growing specifications, it stalled. <br />
In this project we will focus on the most needed features, keeping the requirements to a minimum. <br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
* '''Minimum requirements'''<br />
: Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: [[User:KaKiLa|KaKiLa]], Carnë Draug, Carlo de Falco, Sebastian Schöps<br />
<br />
=== Command line suggestion feature ===<br />
<br />
Currently Octave has no mechanism for suggesting corrections to typographic errors on the command line. An autocomplete/suggestion function is provided (using the double-TAB shortcut), but recent discussions have indicated a desire for a more proactive measure to catch user error. Potential applicants are referred to bug {{bug|46881}} regarding the usage of grey vs. gray. <br />
<br />
Suggested improvements are:<br />
* provide one or more suggested corrections to the user when a command line entry produces an error.<br />
* recognition and suggested correction for apparent syntax errors<br />
* function suggestion(s) when a 'close' match is found (close remains to be defined)<br />
* multiple suggestions if more than one option seems likely, along with a user-friendly method of selecting the appropriate choice.<br />
* user selectable option to disable and/or customize the suggestion behavior<br />
* correct operation, or graceful degradation, whether Octave is run in GUI or command-line mode. <br />
<br />
As mentioned in the bug {{bug|46881}} discussion, this project has little-to-no relation to m-code compatibility. As such, emulation of the behavior of other software is not required, nor even necessarily desired. Octave is free to implement as simple or complex a solution to this feature request as is necessary to provide the best experience to the user. There may be tools, features, or code from other license-compatible projects that can be of use here, and the applicant would be encouraged to identify and leverage such resources as appropriate. <br />
<br />
* '''Minimum requirements'''<br />
: TBD<br />
* '''Difficulty'''<br />
: Easy to Medium.<br />
* '''Mentor'''<br />
: Undetermined<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
* '''Required skills'''<br />
: m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
* '''Difficulty'''<br />
: Difficult.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
* '''Required skills'''<br />
: Knowledge of C++ and C since most libraries are written in those languages.<br />
* '''Difficulty'''<br />
: Medium.<br />
* '''Potential mentor'''<br />
: Carnë Draug<br />
<br />
<br />
<br />
<br />
<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2017&diff=9854OctConf 20172017-02-08T09:29:29Z<p>Cdf: /* Participants */</p>
<hr />
<div>We are happy to announce the upcoming Octave Conference 2017 to be held at [http://home.cern CERN], near Geneva, Switzerland, from March 20th until March 22nd. The Local Organising Committee is happy and proud that CERN will host this event for at least two reasons: Octave [2] is a fundamental tool of analysis and research for hundreds of CERN scientists; Octave and CERN share and promote the same values of openness, cooperation, diversity, quality and commitment.<br />
<br />
The three-day event will be an opportunity for sharing experiences, planning the future of Octave and promoting its use among the scientific community and beyond. There will two open sessions on Monday and Tuesday showcasing Octave and some interesting and successful Octave stories.<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/609833/ Indico].<br />
In addition, *please* add your name to the Participants section of this page so we can plan appropriately.<br />
<br />
We are working out the details of the programme, and the call for contributions and abstract is still open. You are all invited to submit an abstract and present your experience with Octave at the conference!<br />
<br />
We are hopeful that the key members of the Octave development team will make it, both from oversea and from Europe. You can find more updated information on the programme in the [https://indico.cern.ch/event/609833 CERN's OctConf webpage] and in here.<br />
<br />
== Dates ==<br />
<br />
The conference will run for three days from Monday, March 20th through Wednesday, March 22nd.<br />
<br />
<br />
== Location ==<br />
<br />
=== Geneva, Switzerland ===<br />
=== Venue ===<br />
The upcoming Octconf 2017 will take place at [http://home.cern/ CERN] (European Center for Nuclear Research)<br />
<br />
At CERN, the European Organization for Nuclear Research, physicists and engineers are probing the fundamental structure of the universe. They use the world's largest and most complex scientific instruments to study the basic constituents of matter – the fundamental particles. The particles are made to collide together at close to the speed of light. The process gives the physicists clues about how the particles interact, and provides insights into the fundamental laws of nature.<br />
The instruments used at CERN are purpose-built particle accelerators and detectors. Accelerators boost beams of particles to high energies before the beams are made to collide with each other or with stationary targets. Detectors observe and record the results of these collisions.<br />
<br />
Founded in 1954, the CERN laboratory sits astride the Franco-Swiss border near Geneva. It was one of Europe's first joint ventures and now has 22 member states.<br />
<br />
=== Social activities ===<br />
<br />
Two social events have been foreseen, besides the coffee and the lunch breaks:<br />
* A unique visit to [http://visit.cern/tours CERN]<br />
* A [https://en.wikipedia.org/wiki/Fondue Fondue] dinner down-town Geneva<br />
<br />
=== Travelling ===<br />
The information below is taken from [http://visit.cern/exhibitions/how-get-cern CERN instructions].<br />
Please check that link for further details.<br />
<br />
[http://visit.cern/sites/visits.web.cern.ch/files/files/exhibitions/access-map.pdf How to get to CERN infographics]<br />
<br />
CERN Reception - Meyrin<br />
<br />
CERN - European Organization for Nuclear Research<br />
385 route de Meyrin<br />
CH-1217 Meyrin - Geneva<br />
Switzerland<br />
<br />
* GPS Coordinates<br />
Latitude: 46.2314284<br />
<br />
Longitude: 6.0539718<br />
<br />
<br />
==== By train ====<br />
Coming from the Geneva railway station at Cornavin<br />
<br />
Tram - Take the number 18 tram to "CERN" which is the final stop at the CERN entrance.<br />
<br />
Ticket costs 3 CHF full-fare / 2 CHF reduced-fare (Ticket "Tout Genève" on the ticket machine). <br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
==== By car ====<br />
<br />
* From Switzerland<br />
<br />
Follow signs for "Aéroport", "Lyon" and "Meyrin".<br />
<br />
Once you are in Meyrin, follow signs for "St. Genis" (which is just beyond the border, in France). <br />
<br />
Before reaching St Genis, the CERN site is on your left on "Route de Meyrin", just before you reach the border.<br />
<br />
* From France (département of Ain)<br />
<br />
Follow signs for "Gex" or "St. Genis". <br />
When you reach the border, CERN is on your right immediately after passing through customs.<br />
<br />
See [http://visit.cern/exhibitions/how-get-cern-car Parking] for parking information.<br />
<br />
==== By plane ====<br />
Coming from the Geneva International Airport at Cointrin<br />
<br />
Taxi - approximately 35CHF.<br />
<br />
Bus - First take a public transport ticket from the machine you will find at the exit to the baggage collection hall, just before customs control. Then:<br />
<br />
Option 1: Take bus Y direction "CERN" and get off at the CERN stop opposite the large Globe and the CERN site.<br />
<br />
Option 2: Take bus 23, 28 or 57 and get off at the stop "Blandonnet" and then catch the Tram number 18, final stop "CERN".<br />
<br />
See the [http://www.tpg.ch/ TPG] web site for full details.<br />
<br />
<br />
== Accommodation ==<br />
<br />
The conference will take place in the CERN's main site (Meyrin). You can try your luck and search for an accommodation in one of the [http://smb-dep.web.cern.ch/en/CERN_Housing CERN Hostels].<br />
<br />
Should the CERN hostels be full, or should you prefer to stay in Geneva, we advise you to consult your favourite on-line booking portal (www.booking.com, www.tripadvisor.com, www.trivago.com, www.expedia.com etc.) and to contact the hotel directly in order to identify the lowest tariff available for CERN users and collaborators (preferential tariffs may apply in some cases).<br />
<br />
Hotels in the vicinity of "Gare Cornavin" (Geneva's main railway station), or along "Route de Meyrin", are particularly recommended. Tram number 18 links Gare Cornavin to CERN in 20' (see [http://www.tpg.ch/ timetable on the TPG's webpage]). <br />
<br />
Notice that, by staying in hotel, youth hostel or at a campsite, you are entitled to receive a personal and non transferable Geneva Transport Card for free, which will allow you to use the whole public transportation system of Geneva for the length of your stay for free. This includes buses, trams, trains, and yellow taxi-boats - Mouettes. Just ask for it upon arrival on the reception.<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 23:00 (11:00 PM).<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="220">Monday<br/>(General GNU Octave day)</th><br />
<th width="220">Tuesday<br/>(GNU Octave Packages day)</th><br />
<th width="250">Wednesday<br/>(Libre and Open Source Software day)</th><br />
</tr><br />
<tr><br />
<td>9:00-9:30</td><br />
<td>Open Slot</td><br />
<td>Open Slot</td><br />
<td rowspan="2">Unconference</td><br />
</tr><br />
<tr><br />
<td>9:30-10:00</td><br />
<td>Open Slot</td><br />
<td>Open Slot</td><br />
</tr><br />
<tr><br />
<td>10:00-10:15</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td>10:15-10:50</td><br />
<td>Open Slot</td><br />
<td>Open Slot</td><br />
<td rowspan="3">Unconference</td><br />
</tr><br />
<tr><br />
<td>10:50-11:25</td><br />
<td>[https://www.gnu.org/software/octave/doc/interpreter/XREFpublish.html publish] your code with Octave (Kai T. Ohlhus)</td><br />
<td>Open Slot</td><br />
</tr><br />
<tr><br />
<td>11:25-12:00</td><br />
<td>GSoC project: ode15{i,s}<br/>(Francesco Faccio)</td><br />
<td>Open Slot</td><br />
</tr><br />
<tr><br />
<td>12:00-12:45</td><br />
<td><strong>Discussion</strong></td><br />
<td><strong>Discussion</strong></td><br />
<td>8/16-bit simulation with GNU Octave (Andreas Stahel)</td>8<br />
</tr><br />
<tr><br />
<td><br/>12:45-14:00<br/><br/></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
</tr><br />
<tr><br />
<td>14:00-14:35</td><br />
<td rowspan="3">Open Slot (Pleanry session: CERN main auditorium)</td><br />
<td rowspan="3">Open Slot (Pleanry session: CERN main auditorium)</td><br />
<td rowspan="3">Visit to CERN sites</td><br />
</tr><br />
<tr><br />
<td>14:35-15:10</td><br />
</tr><br />
<tr><br />
<td>15:10-15:45</td><br />
</tr><br />
<tr><br />
<td>15:45-16:00</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td><br/><br/>16:00-18:00<br/><br/><br/></td><br />
<td><strong>Code Sprint</strong></td><br />
<td><strong>Code Sprint</strong></td><br />
<td><strong>Organization of OctConf2018</strong></td><br />
</tr><br />
<tr><br />
<td>18:00-19:00</td><br />
<td rowspan="2">Fondue night (alternative 1)</td><br />
<td rowspan="2">Fondue night (alternative 2)</td><br />
<td rowspan="2">Closing and Farewell</td><br />
</tr><br />
<tr><br />
<td>19:00-20:00</td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
<tr><br />
<td>Fast approximation of complicated simulators</td><br />
<td>[[User:KaKiLa |JuanPi Carbajal]]</td><br />
</tr><br />
<tr><br />
<td>VSDP: Verified SemiDefinite Programming</td><br />
<td>[[User:Siko1056|Kai T. Ohlhus]]</td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr> <br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<br />
</table><br />
<br />
== Participants ==<br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/609833/ Indico].<br />
<br />
* [[User:KaKiLa|JuanPi Carbajal]]<br />
* [[User:Francesco Faccio|Francesco Faccio]] (need funding for travel)<br />
* [[User:jwe|John W. Eaton]] (need funding for travel)<br />
* [[User:rik|Rik]] (need funding for travel)<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Siko1056|Kai T. Ohlhus]]<br />
* [[User:Oheim|Oliver Heimlich]] (probably only 2 days, waits for permission from wife)<br />
* [[User:Carandraug|Carnë Draug]] (likely to attend but unsure. Will only be able to confirm on the 10th of February)<br />
* [[User:Andy1978|Andreas Weber]] (likely to attend but have to wait for the final okay from employer)<br />
* Valentin Ortega Clavero (likely to attend but have to wait for the final okay from employer)<br />
* Andrea Latina<br />
* Andreas Stahel<br />
* [[User:CdF|Carlo de Falco]] (likely to attend, probably one day only)<br />
<br />
== Funding ==<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2015]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2018]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2017]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2017&diff=9784OctConf 20172017-02-02T11:26:29Z<p>Cdf: Undo revision 9783 by Cdf (talk)</p>
<hr />
<div>OctConf 2017 will take place at CERN, Geneva, Switzerland for three days from March 20 through March 22. <br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/609833/ Indico].<br />
In addition, *please* add your name to the Participants section of this page so we can plan appropriately.<br />
<br />
== Location ==<br />
<br />
=== Geneva, Switzerland ===<br />
=== Venue ===<br />
The upcoming Octconf 2017 will take place at CERN (European Center for Nuclear Research). See https://en.wikipedia.org/wiki/CERN.<br />
<br />
=== Travelling ===<br />
<br />
== Dates ==<br />
<br />
The conference will run for three days from Monday, March 20th through Wednesday, March 22nd.<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
<br />
* We need to fill up the timetable. Not knowing how you organized the previous Octave conferences and not being Octave developers, we rely on you guys. From our side, I just reiterate what John Evans wrote on Nov 22,<br />
<br />
[OPENING SESSION - for which we reserved the CERN Main Auditorium]<br />
I have some comments regarding the session concerning the potential use of Octave at CERN. Would it be possible that this be made an open session? We have 4-500 MATLAB users so there is hope that it could be well attended.<br />
I could try and find some user(s) at CERN using Octave for a "big" project that they'd be willing to present. Failing that, maybe an Octave expert could present Octave and its uses and future developments.<br />
<br />
[WE SHOULD FORESEE THIS DISCUSSION]<br />
Would anybody be willing and brave enough to look at CERN-supplied MATLAB code and see if it could be done in Octave?<br />
<br />
[POSTER SESSION AND SOCIALIZING]<br />
How many posters are there usually in the poster session?<br />
Would it make sense to have this "how Octave can replace MATLAB (and other) tools" session followed by the poster session?<br />
We could arrange refreshments to encourage people to hang around for possible follow-ups.<br />
<br />
<br />
*regarding "social activities" :<br />
<br />
** We can offer, as I mentioned, a visit to some interesting CERN sites. This can take from a few to several hours. It could be planned for Wednesday afternoon.<br />
<br />
** For the evening of Monday, or of Tuesday, we thought we could have a "Fondue" dinner downtown Geneva. There are good and affordable Fondue restaurants that can be reached by tram within 30/40 minutes from CERN.<br />
<br />
** During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 11pm.<br />
<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="230">Monday<br/>()</th><br />
<th width="230">Tuesday<br/>()</th><br />
<th width="230">Wednesday<br/>()</th><br />
</tr><br />
<tr><br />
<td><br/><br/>9:00-10:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:00-10:15</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td>10:15-10:50</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:50-11:25</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>11:25-12:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>12:00-12:30</td><br />
<td><strong>Discussion</strong></td><br />
<td><strong>Discussion</strong></td><br />
</tr><br />
<tr><br />
<td><br/>12:30-14:00<br/><br/></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
</tr><br />
<tr><br />
<td>14:00-14:35</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>14:35-15:10</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>15:10-15:45</td><br />
</tr><br />
<tr><br />
<td>15:45-16:00</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td><br/><br/>16:00-18:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>18:00-19:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>19:00-20:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr> <br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<br />
</table><br />
<br />
== Participants ==<br />
<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* [[User:Francesco Faccio|Francesco Faccio]]<br />
* [[User:jwe|John W. Eaton]] (need funding for travel)<br />
* [[User:rik|Rik]] (need funding for travel)<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Siko1056|Kai T. Ohlhus]] (waits for permission from employer)<br />
* [[User:Oheim|Oliver Heimlich]] (probably only 2 days, waits for permission from wife)<br />
<br />
== Funding ==<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2015]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2018]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2017]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2017&diff=9783OctConf 20172017-02-02T11:25:30Z<p>Cdf: /* Previous OctConf */</p>
<hr />
<div>OctConf 2017 will take place at CERN, Geneva, Switzerland for three days from March 20 through March 22. <br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/609833/ Indico].<br />
In addition, *please* add your name to the Participants section of this page so we can plan appropriately.<br />
<br />
== Location ==<br />
<br />
=== Geneva, Switzerland ===<br />
=== Venue ===<br />
The upcoming Octconf 2017 will take place at CERN (European Center for Nuclear Research). See https://en.wikipedia.org/wiki/CERN.<br />
<br />
=== Travelling ===<br />
<br />
== Dates ==<br />
<br />
The conference will run for three days from Monday, March 20th through Wednesday, March 22nd.<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
<br />
* We need to fill up the timetable. Not knowing how you organized the previous Octave conferences and not being Octave developers, we rely on you guys. From our side, I just reiterate what John Evans wrote on Nov 22,<br />
<br />
[OPENING SESSION - for which we reserved the CERN Main Auditorium]<br />
I have some comments regarding the session concerning the potential use of Octave at CERN. Would it be possible that this be made an open session? We have 4-500 MATLAB users so there is hope that it could be well attended.<br />
I could try and find some user(s) at CERN using Octave for a "big" project that they'd be willing to present. Failing that, maybe an Octave expert could present Octave and its uses and future developments.<br />
<br />
[WE SHOULD FORESEE THIS DISCUSSION]<br />
Would anybody be willing and brave enough to look at CERN-supplied MATLAB code and see if it could be done in Octave?<br />
<br />
[POSTER SESSION AND SOCIALIZING]<br />
How many posters are there usually in the poster session?<br />
Would it make sense to have this "how Octave can replace MATLAB (and other) tools" session followed by the poster session?<br />
We could arrange refreshments to encourage people to hang around for possible follow-ups.<br />
<br />
<br />
*regarding "social activities" :<br />
<br />
** We can offer, as I mentioned, a visit to some interesting CERN sites. This can take from a few to several hours. It could be planned for Wednesday afternoon.<br />
<br />
** For the evening of Monday, or of Tuesday, we thought we could have a "Fondue" dinner downtown Geneva. There are good and affordable Fondue restaurants that can be reached by tram within 30/40 minutes from CERN.<br />
<br />
** During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 11pm.<br />
<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="230">Monday<br/>()</th><br />
<th width="230">Tuesday<br/>()</th><br />
<th width="230">Wednesday<br/>()</th><br />
</tr><br />
<tr><br />
<td><br/><br/>9:00-10:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:00-10:15</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td>10:15-10:50</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:50-11:25</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>11:25-12:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>12:00-12:30</td><br />
<td><strong>Discussion</strong></td><br />
<td><strong>Discussion</strong></td><br />
</tr><br />
<tr><br />
<td><br/>12:30-14:00<br/><br/></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
</tr><br />
<tr><br />
<td>14:00-14:35</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>14:35-15:10</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>15:10-15:45</td><br />
</tr><br />
<tr><br />
<td>15:45-16:00</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td><br/><br/>16:00-18:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>18:00-19:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>19:00-20:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr> <br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<br />
</table><br />
<br />
== Participants ==<br />
<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* [[User:Francesco Faccio|Francesco Faccio]]<br />
* [[User:jwe|John W. Eaton]] (need funding for travel)<br />
* [[User:rik|Rik]] (need funding for travel)<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Siko1056|Kai T. Ohlhus]] (waits for permission from employer)<br />
* [[User:Oheim|Oliver Heimlich]] (probably only 2 days, waits for permission from wife)<br />
<br />
== Funding ==<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2015]]<br />
<br />
[[OctConf 2014]]<br />
<br />
[[OctConf 2013]]<br />
<br />
[[OctConf 2012]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2018]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2017]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=OctConf_2017&diff=9782OctConf 20172017-02-02T11:15:09Z<p>Cdf: /* Participants */</p>
<hr />
<div>OctConf 2017 will take place at CERN, Geneva, Switzerland for three days from March 20 through March 22. <br />
To register officially, please use the CERN conference manager [https://indico.cern.ch/event/609833/ Indico].<br />
In addition, *please* add your name to the Participants section of this page so we can plan appropriately.<br />
<br />
== Location ==<br />
<br />
=== Geneva, Switzerland ===<br />
=== Venue ===<br />
The upcoming Octconf 2017 will take place at CERN (European Center for Nuclear Research). See https://en.wikipedia.org/wiki/CERN.<br />
<br />
=== Travelling ===<br />
<br />
== Dates ==<br />
<br />
The conference will run for three days from Monday, March 20th through Wednesday, March 22nd.<br />
<br />
== Suggestions for Sessions ==<br />
<br />
Approximately half of each day will be devoted to presentations. The remainder will be used for informal discussions, code sprints, etc.<br />
<br />
Please propose session topics in the schedule below. The actual time slot you pick is not important--we can re-arrange the schedule later--but we need to know what topics are of interest.<br />
<br />
In addition, if you have a poster, rather than a full presentation, there is a separate sign-up sheet below.<br />
<br />
=== Schedule ===<br />
<br />
* We need to fill up the timetable. Not knowing how you organized the previous Octave conferences and not being Octave developers, we rely on you guys. From our side, I just reiterate what John Evans wrote on Nov 22,<br />
<br />
[OPENING SESSION - for which we reserved the CERN Main Auditorium]<br />
I have some comments regarding the session concerning the potential use of Octave at CERN. Would it be possible that this be made an open session? We have 4-500 MATLAB users so there is hope that it could be well attended.<br />
I could try and find some user(s) at CERN using Octave for a "big" project that they'd be willing to present. Failing that, maybe an Octave expert could present Octave and its uses and future developments.<br />
<br />
[WE SHOULD FORESEE THIS DISCUSSION]<br />
Would anybody be willing and brave enough to look at CERN-supplied MATLAB code and see if it could be done in Octave?<br />
<br />
[POSTER SESSION AND SOCIALIZING]<br />
How many posters are there usually in the poster session?<br />
Would it make sense to have this "how Octave can replace MATLAB (and other) tools" session followed by the poster session?<br />
We could arrange refreshments to encourage people to hang around for possible follow-ups.<br />
<br />
<br />
*regarding "social activities" :<br />
<br />
** We can offer, as I mentioned, a visit to some interesting CERN sites. This can take from a few to several hours. It could be planned for Wednesday afternoon.<br />
<br />
** For the evening of Monday, or of Tuesday, we thought we could have a "Fondue" dinner downtown Geneva. There are good and affordable Fondue restaurants that can be reached by tram within 30/40 minutes from CERN.<br />
<br />
** During the daytime: CERN offers many areas where people can socialize and/or discuss, informally. For instance, the CERN main restaurant is open until 11pm.<br />
<br />
<br />
<table class="tg" border="1" width="800" style="text-align: center"><br />
<tr><br />
<th width="110">Time</th><br />
<th width="230">Monday<br/>()</th><br />
<th width="230">Tuesday<br/>()</th><br />
<th width="230">Wednesday<br/>()</th><br />
</tr><br />
<tr><br />
<td><br/><br/>9:00-10:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:00-10:15</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td>10:15-10:50</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>10:50-11:25</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>11:25-12:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>12:00-12:30</td><br />
<td><strong>Discussion</strong></td><br />
<td><strong>Discussion</strong></td><br />
</tr><br />
<tr><br />
<td><br/>12:30-14:00<br/><br/></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
<td><strong>Lunch</strong></td><br />
</tr><br />
<tr><br />
<td>14:00-14:35</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>14:35-15:10</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>15:10-15:45</td><br />
</tr><br />
<tr><br />
<td>15:45-16:00</td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
<td><strong>Coffee</strong></td><br />
</tr><br />
<tr><br />
<td><br/><br/>16:00-18:00<br/><br/><br/></td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>18:00-19:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
<tr><br />
<td>19:00-20:00</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
<td><br/>()</td><br />
</tr><br />
</table><br />
<br />
=== Poster Session ===<br />
<br />
If you have a poster demonstrating how you use Octave to address an application in your field please add your name and poster topic to the list below. We will schedule an appropriately sized space based on the number of posters.<br />
<br />
Confirmed Posters:<br />
<br />
<table class="tg" border="0" width="600" style="text-align: left"><br />
<tr><br />
<th width="400">Title</th><br />
<th width="200">Author</th><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr> <br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td></td><br />
</tr><br />
<br />
</table><br />
<br />
== Participants ==<br />
<br />
* [[User:KaKiLa|Juan Pablo Carbajal]]<br />
* [[User:Francesco Faccio|Francesco Faccio]]<br />
* [[User:jwe|John W. Eaton]] (need funding for travel)<br />
* [[User:rik|Rik]] (need funding for travel)<br />
* [[User:Doug|Douglas Stewart]]<br />
* [[User:Siko1056|Kai T. Ohlhus]] (waits for permission from employer)<br />
* [[User:Oheim|Oliver Heimlich]] (probably only 2 days, waits for permission from wife)<br />
<br />
== Funding ==<br />
<br />
== Previous OctConf ==<br />
[[OctConf 2015]]<br />
<br />
== Next OctConf ==<br />
[[OctConf 2018]]<br />
<br />
[[Category:OctConf]]<br />
[[Category:2017]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Packages&diff=9739Packages2017-01-12T16:19:33Z<p>Cdf: /* Other Packages */</p>
<hr />
<div>This is a list of Packages available for GNU Octave.<br />
<br />
= Octave Forge =<br />
:''Main: [[Octave Forge]]''<br />
<br />
The official community packages: http://octave.sourceforge.net/ <br />
<br />
You may also take a look at the Wiki page for each package: [[:Category:Octave-Forge]]<br />
<br />
= Other Packages =<br />
<br />
Feel free to add unlisted packages.<br />
<br />
== GeoPDEs ==<br />
<br />
[http://rafavzqz.github.io/geopdes/ GeoPDEs] is an open source and free package for the research and teaching of Isogeometric Analysis, written in Octave and fully compatible with Matlab.<br />
<br />
The GeoPDEs package provides a common and flexible framework for implementing and testing new isogeometric methods for the solution of partial differential equations. <br />
<br />
== FEATool ==<br />
<br />
FEATool is a commercial and proprietary Octave and Matlab FEM toolbox for modeling and simulation of physics and engineering applications with the finite element method. <br />
<br />
* http://www.precisesimulation.com/featool/<br />
<br />
== go-redis ==<br />
<br />
GNU Octave Redis client<br />
<br />
* https://github.com/markuman/go-redis<br />
<br />
== LIBSVM, LIBLINEAR ==<br />
<br />
Libraries for support vector machine / machine learning classification, regression, and distribution estimation problems. C++, with an interface to Octave.<br />
<br />
* http://www.csie.ntu.edu.tw/~cjlin/libsvm<br />
* http://www.csie.ntu.edu.tw/~cjlin/liblinear<br />
<br />
== ltfat ==<br />
<br />
The Large Time-Frequency Analysis Toolbox®. Please note, this package is available on Octave Forge too, but it has its own website.<br />
<br />
* http://ltfat.sourceforge.net/<br />
<br />
== mex-sqlite3 ==<br />
<br />
An extension for MATLAB® or GNU/octave to access sqlite3 databases <br />
<br />
* https://github.com/rmartinjak/mex-sqlite3<br />
<br />
== octave-network-toolbox ==<br />
<br />
A set of graph/networks analysis functions in Octave<br />
<br />
* http://aeolianine.github.io/octave-networks-toolbox/<br />
<br />
== octsympy ==<br />
<br />
This package is now part of Octave Forge as the new [http://octave.sourceforge.net/symbolic symbolic package]. Main development site is still at https://github.com/cbm755/octsympy.<br />
<br />
== shogun ==<br />
<br />
The Shogun Machine Learning Toolbox® <br />
<br />
* https://github.com/shogun-toolbox/shogun<br />
<br />
== vlfeat == <br />
<br />
The VLFeat open source library implements popular computer vision algorithms including HOG, SIFT, MSER, k-means, hierarchical k-means, agglomerative information bottleneck, SLIC superpixels, and quick shift.<br />
<br />
* http://www.vlfeat.org/index.html<br />
<br />
== epanet-octave == <br />
<br />
The epanet-octave open source library is a wrapper, including some scripts, to call Epanet Toolkit. Functions are adapted to improve its usability in GNU Octave (e.g. allowing vectors as EpaNet Toolkit function inputs). Still under development. <br />
<br />
* https://forja.cica.es/projects/epanet-octave/<br />
<br />
== mexopencv ==<br />
<br />
Collection and a development kit of matlab mex functions for OpenCV library<br />
<br />
* http://kyamagu.github.io/mexopencv<br />
* https://github.com/kyamagu/mexopencv<br />
== See also ==<br />
* [[Creating packages]]<br />
<br />
[[Category:Packages| ]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Steps_to_apply&diff=8923Steps to apply2016-03-14T06:54:35Z<p>Cdf: /* Your steps to apply */</p>
<hr />
<div>== Your steps to apply ==<br />
# Find out that you would like to work together with us this summer!<br />
# Tell us about that and work on your project proposal. Do this together with us! Best place is your wiki user page, see below.<br />
# Fill out our '''''public''''' application template. This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''' and copying the '''[[Template:Student_application_template_public|template]]''' from its page. <br/> You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
# Fill out our '''''private''''' application template. This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and ''' adding the required information to your application at Google '''.<br/> Only the organization admin and the possible mentors will see this data.<br/>You can still edit it after submitting until the deadline!<br />
# 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!<br />
# Start implementing your very own proposal! Code the summer away ;-)<br />
<br />
[[Category:2012]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=8909Ocs package2016-03-10T12:20:55Z<p>Cdf: /* A circuit with a linear VCVS */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
<br />
OCS was developed during the CoMSON (Coupled Multiscale Simulation and Optimization) project which involved several universities but also several industrial partners.<br />
<br />
Each of the industrial partners at the time was using its own circuit simulation software and each software had different file formats for circuit netlists.<br />
<br />
Given the purposes of the project and the composition of the consortium the main design objectives for OCS where<br />
<br />
* provide a format for "element evaluators" independent of time-stepping algorithms<br />
* provide a "hierarchical" data structure where elements could be composed themselves of lumped-element networks<br />
* allow coupling of lumped-element networks (0D) and 1D/2D/3D device models<br />
* use an intermediate/interchange file format so that none of the formats in use by the industrial partners would be favoured over the others<br />
* be written in an interpreted language for quick prototyping and easy maintainance<br />
* be Free Software<br />
<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|OCS structure format |<syntaxhighlight lang="octave" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , pvmatrix(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
=== A circuit with a linear VCVS ===<br />
<br />
To parse an IFF format netlist of the VCVS circuit we can use the following command<br />
<br />
{{Code|Load the VCVS circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("vcvs");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "vcvs.cir" shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
%0.1b1<br />
% A Simple linear VCVS example<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
1 4<br />
Ampl f delay shift<br />
1 1 0.0 0.0<br />
1 0 <br />
END<br />
% VCVS<br />
Mvcvs LIN 4 1<br />
1 1<br />
Gain<br />
5.0<br />
2 0 1 0<br />
% Resistor<br />
Mresistors LIN 2 1<br />
1 1<br />
R<br />
1<br />
1 2<br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 V_controller<br />
2 V_controlled<br />
</syntaxhighlight><br />
}}<br />
<br />
The implementation for the VCVS with linear gain is shown below<br />
<br />
{{Code|Model evaluator file for simple VCVS model |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mvcvs (string, parameters, parameternames, extvar,<br />
intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
##LCR part<br />
case "LIN"<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
j = intvar (1);<br />
Vin = extvar (3) - extvar (4);<br />
V = Vin * Gain;<br />
<br />
a = zeros (5); <br />
b = [0 0 0 0 1;<br />
0 0 0 0 -1;<br />
0 0 0 0 0;<br />
0 0 0 0 0;<br />
1 -1 -Gain Gain 0];<br />
<br />
c = [0 0 0 0 0];<br />
break<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:VCVS_result.png|thumb| Result of the VCVS simulation]]<br />
<br />
To run a simulation with this circuit use the following commands:<br />
<br />
{{Code|Run a simple transient simulation with the VCVS circuit |<syntaxhighlight lang="octave" style="font-size:13px"><br />
>> x = [0 0 0 0]';<br />
>> t = linspace(0,1,50);<br />
>> [out, niter] = tst_backward_euler (outstruct, x, t, 1e-6, 100, pltvars, [0 1]);<br />
</syntaxhighlight><br />
}}<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (Carbajal, J. P. et al.(2015). [http://www.mitpressjournals.org/doi/abs/10.1162/NECO_a_00694?journalCode=neco#.VgFNn9tSukp Memristor models for machine learning]. Neural Computation, 27(3). Learning; Materials Science. doi:10.1162/NECO_a_00694</ref><br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=File:VCVS_result.png&diff=8908File:VCVS result.png2016-03-10T12:19:08Z<p>Cdf: Cdf uploaded a new version of File:VCVS result.png</p>
<hr />
<div>result of the transient simulation of a simple VCVS circuit</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=File:VCVS_result.png&diff=8907File:VCVS result.png2016-03-10T12:17:59Z<p>Cdf: result of the transient simulation of a simple VCVS circuit</p>
<hr />
<div>result of the transient simulation of a simple VCVS circuit</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=8906Ocs package2016-03-10T12:14:02Z<p>Cdf: /* OCS : Octave Circuit Simulator */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
<br />
OCS was developed during the CoMSON (Coupled Multiscale Simulation and Optimization) project which involved several universities but also several industrial partners.<br />
<br />
Each of the industrial partners at the time was using its own circuit simulation software and each software had different file formats for circuit netlists.<br />
<br />
Given the purposes of the project and the composition of the consortium the main design objectives for OCS where<br />
<br />
* provide a format for "element evaluators" independent of time-stepping algorithms<br />
* provide a "hierarchical" data structure where elements could be composed themselves of lumped-element networks<br />
* allow coupling of lumped-element networks (0D) and 1D/2D/3D device models<br />
* use an intermediate/interchange file format so that none of the formats in use by the industrial partners would be favoured over the others<br />
* be written in an interpreted language for quick prototyping and easy maintainance<br />
* be Free Software<br />
<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|OCS structure format |<syntaxhighlight lang="octave" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , pvmatrix(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
=== A circuit with a linear VCVS ===<br />
<br />
To parse an IFF format netlist of the VCVS circuit we can use the following command<br />
<br />
{{Code|Load the VCVS circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("vcvs");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "vcvs.cir" shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
%0.1b1<br />
% A Simple linear VCVS example<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
1 4<br />
Ampl f delay shift<br />
1 1 0.0 0.0<br />
1 0 <br />
END<br />
% VCVS<br />
Mvcvs LIN 4 1<br />
1 1<br />
Gain<br />
5.0<br />
2 0 1 0<br />
% Resistor<br />
Mresistors LIN 2 1<br />
1 1<br />
R<br />
1<br />
1 2<br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 V_controller<br />
2 V_controlled<br />
</syntaxhighlight><br />
}}<br />
<br />
The implementation for the VCVS with linear gain is shown below<br />
<br />
{{Code|Model evaluator file for simple VCVS model |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mvcvs (string, parameters, parameternames, extvar,<br />
intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
##LCR part<br />
case "LIN"<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
j = intvar (1);<br />
Vin = extvar (3) - extvar (4);<br />
V = Vin * Gain;<br />
<br />
a = zeros (5); <br />
b = [0 0 0 0 1;<br />
0 0 0 0 -1;<br />
0 0 0 0 0;<br />
0 0 0 0 0;<br />
1 -1 -Gain Gain 0];<br />
<br />
c = [0 0 0 0 0];<br />
break<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
To run a simulation with this circuit use the following commands:<br />
<br />
{{Code|Run a simple transient simulation with the VCVS circuit |<syntaxhighlight lang="octave" style="font-size:13px"><br />
>> x = [0 0 0 0]';<br />
>> t = linspace(0,1,50);<br />
>> [out, niter] = tst_backward_euler (outstruct, x, t, 1e-6, 100, pltvars, [0 1]);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:VCVS_result.png|thumb| Result of the VCVS simulation]]<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (Carbajal, J. P. et al.(2015). [http://www.mitpressjournals.org/doi/abs/10.1162/NECO_a_00694?journalCode=neco#.VgFNn9tSukp Memristor models for machine learning]. Neural Computation, 27(3). Learning; Materials Science. doi:10.1162/NECO_a_00694</ref><br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=8905Ocs package2016-03-10T12:10:04Z<p>Cdf: /* Tutorials */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
<br />
OCS was developed during the CoMSON (Coupled Multiscale Simulation and Optimization) project which involved several universities but also several industrial partners.<br />
<br />
Each of the industrial partners at the time was using its own circuit simulation software and each software had different file formats for circuit netlists.<br />
<br />
Given the purposes of the project and the composition of the consortium the main design objectives for OCS where<br />
<br />
* provide a format for "element evaluators" independent of time-stepping algorithms<br />
* provide a "hierarchical" data structure where elements could be composed themselves of lumped-element networks<br />
* allow coupling of lumped-element networks (0D) and 1D/2D/3D device models<br />
* use an intermediate/interchange file format so that none of the formats in use by the industrial partners would be favoured over the others<br />
* be written in an interpreted language for quick prototyping and easy maintainance<br />
* be Free Software<br />
<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|OCS structure format |<syntaxhighlight lang="octave" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , pvmatrix(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
=== A circuit with a linear VCVS ===<br />
<br />
To parse an IFF format netlist of the VCVS circuit we can use the following command<br />
<br />
{{Code|Load the VCVS circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("vcvs");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "vcvs.cir" shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
%0.1b1<br />
% A Simple linear VCVS example<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
1 4<br />
Ampl f delay shift<br />
1 1 0.0 0.0<br />
1 0 <br />
END<br />
% VCVS<br />
Mvcvs LIN 4 1<br />
1 1<br />
Gain<br />
5.0<br />
2 0 1 0<br />
% Resistor<br />
Mresistors LIN 2 1<br />
1 1<br />
R<br />
1<br />
1 2<br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the VCVS circuit (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 V_controller<br />
2 V_controlled<br />
</syntaxhighlight><br />
}}<br />
<br />
The implementation for the VCVS with linear gain is shown below<br />
<br />
{{Code|Model evaluator file for simple VCVS model |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mvcvs (string, parameters, parameternames, extvar,<br />
intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
##LCR part<br />
case "LIN"<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
j = intvar (1);<br />
Vin = extvar (3) - extvar (4);<br />
V = Vin * Gain;<br />
<br />
a = zeros (5); <br />
b = [0 0 0 0 1;<br />
0 0 0 0 -1;<br />
0 0 0 0 0;<br />
0 0 0 0 0;<br />
1 -1 -Gain Gain 0];<br />
<br />
c = [0 0 0 0 0];<br />
break<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
{{Code|Run a simple transient simulation with the VCVS circuit |<syntaxhighlight lang="octave" style="font-size:13px"><br />
>> x = [0 0 0 0]';<br />
>> t = linspace(0,1,50);<br />
>> [out, niter] = tst_backward_euler (outstruct, x, t, 1e-6, 100, pltvars, [0 1]);<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (Carbajal, J. P. et al.(2015). [http://www.mitpressjournals.org/doi/abs/10.1162/NECO_a_00694?journalCode=neco#.VgFNn9tSukp Memristor models for machine learning]. Neural Computation, 27(3). Learning; Materials Science. doi:10.1162/NECO_a_00694</ref><br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.<br />
<br />
[[Category:Octave-Forge]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=8228Summer of Code - Getting Started2016-03-01T09:24:23Z<p>Cdf: /* Improve iterative methods for sparse linear systems */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://www.google-melange.com/gsoc/homepage/google/gsoc2015 Google] and [http://sophia.estec.esa.int/socis2015 ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
If you like any of the projects described below, these are the steps you need to follow to apply:<br />
<br />
* '''Help Us Get To Know You'''<br><br />
: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
:: '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
:: '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, show us that you are motivated and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Find Something That Interests You'''<br />
: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on e-mail and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
* '''Prepare Your Proposal With Us'''<br />
: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
* '''Complete Your Application'''<br />
: Fill out our '''''public''''' application template.<br />
:: This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
:: You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
: Fill out our '''''private''''' application template.<br />
:: This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
:: Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
: 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.<br />
: If you've ever done a <tt>configure && make && make install</tt> series of commands, you have already used the GNU build system.<br />
: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.'''<br />
* '''The Version Control System'''<br />
: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
: You will be expected to follow the same procedures as other contributors and core developers.<br />
: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions in Octave.<br />
<br />
=== Matlab Compatible DAE solver ===<br />
<br />
The goal is to implement a Matlab compatible adaptive BDF solver for Differential Algebraic Equations (DAEs).<br />
The interface would need to be compatible with ode15s while for the backend the <br />
[https://computation.llnl.gov/casc/sundials/main.html SUNDIALS] library would be used, which has both a C and a MEX interface.<br />
This function should eventually be included in Octave core together with the other [http://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/ode/ ODE solvers] that will be released with version 4.2, but could be intially developed as an addition to the [https://sourceforge.net/p/octave/odepkg/ci/default/tree/ odepkg] package.<br />
<br />
'''Required skills''': C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
'''Difficulty''': medium.<br />
'''Potential mentors''': Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
'''Potential mentor''': Jordi Gutiérrez Hermoso<br />
<br />
=== Generalised eigenvalue problem ===<br />
<br />
[http://www.mathworks.com/help/techdoc/ref/eig.html Certain calling forms] of the <tt>eig</tt> function are currently missing, including preliminary balancing; computing left eigenvectors as a third output; and choosing among generalized eigenvalue algorithms. See also [http://octave.1599824.n4.nabble.com/General-eigenvalue-problem-proposal-td4651990.html this discussion]. <br />
<br />
'''Required skills''': C++; familiarity with numerical linear algebra and LAPACK.<br />
<br />
'''Difficulty''': medium.<br />
<br />
'''Potential mentor''': Nir Krakauer<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has have been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an octave package as it was done for the Control package.<br />
[[TISEAN_package | Lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
'''Required skills''': m-file scripting, c/C++ and FORTRAN API knowledge. <br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': [[User:KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. Currently, communication between Octave and Python is handled with a pipe (see "help popen2") and parsing text. However, this is fragile when things go wrong: for example, catching exceptions from Python is a bit ad hoc.<br />
<br />
The main aim of this proposed project is to implement (or even better co-opt an existing) C/C++ oct-file interface that interacts with Python as a library, and e.g., deals gracefully with exceptions. This could either supplement the existing IPC or replace it altogether.<br />
<br />
'''Required skills''': m-file scripting, C/C++, and Python<br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': Colin B. Macdonald<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. If the student has previous knowledge in interval analysis, it is also possible to implement such missing algorithms (as m-files) or improve the existing algorithms. <br />
<br />
'''Required skills''': m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement)<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Mentor''': [[User:oheim|Oliver Heimlich]]<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). Their descriptions and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision<br />
and a synchronization of the codes.<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), tfqmr and bicgstabl (generale matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available [www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf here]<br />
<br />
<br />
'''Mentor''': Marco Caliari, Carlo de Falco<br />
<br />
== Infrastructure ==<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* support for multiple Octave installs<br />
* support for multiple version packages<br />
* support for system-wide and user installed packages<br />
* automatic handling of dependencies<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* management of tests and demos in C++ sources of packages<br />
* think ahead for multiple <br />
* easily load or check specific package versions<br />
<br />
The current {{codeline|pkg}} also performs some functions which probably should not. Instead a package for developers should be created with such tools.<br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
'''Minimum requirements''': Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
<br />
'''Difficulty''': Easy to Medium<br />
<br />
'''Mentor''': Carnë Draug<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
'''Required skills''': m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
<br />
'''Difficulty''': difficult<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
'''Required skills''': knowledge of C++ and C since most libraries are written in those languages<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=8227Summer of Code - Getting Started2016-03-01T09:23:58Z<p>Cdf: /* Improve iterative methods for sparse linear systems */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://www.google-melange.com/gsoc/homepage/google/gsoc2015 Google] and [http://sophia.estec.esa.int/socis2015 ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
If you like any of the projects described below, these are the steps you need to follow to apply:<br />
<br />
* '''Help Us Get To Know You'''<br><br />
: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
:: '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
:: '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, show us that you are motivated and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Find Something That Interests You'''<br />
: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on e-mail and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
* '''Prepare Your Proposal With Us'''<br />
: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
* '''Complete Your Application'''<br />
: Fill out our '''''public''''' application template.<br />
:: This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
:: You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
: Fill out our '''''private''''' application template.<br />
:: This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
:: Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
: 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.<br />
: If you've ever done a <tt>configure && make && make install</tt> series of commands, you have already used the GNU build system.<br />
: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.'''<br />
* '''The Version Control System'''<br />
: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
: You will be expected to follow the same procedures as other contributors and core developers.<br />
: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions in Octave.<br />
<br />
=== Matlab Compatible DAE solver ===<br />
<br />
The goal is to implement a Matlab compatible adaptive BDF solver for Differential Algebraic Equations (DAEs).<br />
The interface would need to be compatible with ode15s while for the backend the <br />
[https://computation.llnl.gov/casc/sundials/main.html SUNDIALS] library would be used, which has both a C and a MEX interface.<br />
This function should eventually be included in Octave core together with the other [http://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/ode/ ODE solvers] that will be released with version 4.2, but could be intially developed as an addition to the [https://sourceforge.net/p/octave/odepkg/ci/default/tree/ odepkg] package.<br />
<br />
'''Required skills''': C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
'''Difficulty''': medium.<br />
'''Potential mentors''': Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
'''Potential mentor''': Jordi Gutiérrez Hermoso<br />
<br />
=== Generalised eigenvalue problem ===<br />
<br />
[http://www.mathworks.com/help/techdoc/ref/eig.html Certain calling forms] of the <tt>eig</tt> function are currently missing, including preliminary balancing; computing left eigenvectors as a third output; and choosing among generalized eigenvalue algorithms. See also [http://octave.1599824.n4.nabble.com/General-eigenvalue-problem-proposal-td4651990.html this discussion]. <br />
<br />
'''Required skills''': C++; familiarity with numerical linear algebra and LAPACK.<br />
<br />
'''Difficulty''': medium.<br />
<br />
'''Potential mentor''': Nir Krakauer<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has have been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an octave package as it was done for the Control package.<br />
[[TISEAN_package | Lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
'''Required skills''': m-file scripting, c/C++ and FORTRAN API knowledge. <br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': [[User:KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. Currently, communication between Octave and Python is handled with a pipe (see "help popen2") and parsing text. However, this is fragile when things go wrong: for example, catching exceptions from Python is a bit ad hoc.<br />
<br />
The main aim of this proposed project is to implement (or even better co-opt an existing) C/C++ oct-file interface that interacts with Python as a library, and e.g., deals gracefully with exceptions. This could either supplement the existing IPC or replace it altogether.<br />
<br />
'''Required skills''': m-file scripting, C/C++, and Python<br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': Colin B. Macdonald<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. If the student has previous knowledge in interval analysis, it is also possible to implement such missing algorithms (as m-files) or improve the existing algorithms. <br />
<br />
'''Required skills''': m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement)<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Mentor''': [[User:oheim|Oliver Heimlich]]<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). Their descriptions and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision<br />
and a synchronization of the codes.<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), tfqmr and bicgstabl (generale matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available here<br />
www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf<br />
<br />
'''Mentor''': Marco Caliari, Carlo de Falco<br />
<br />
== Infrastructure ==<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* support for multiple Octave installs<br />
* support for multiple version packages<br />
* support for system-wide and user installed packages<br />
* automatic handling of dependencies<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* management of tests and demos in C++ sources of packages<br />
* think ahead for multiple <br />
* easily load or check specific package versions<br />
<br />
The current {{codeline|pkg}} also performs some functions which probably should not. Instead a package for developers should be created with such tools.<br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
'''Minimum requirements''': Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
<br />
'''Difficulty''': Easy to Medium<br />
<br />
'''Mentor''': Carnë Draug<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
'''Required skills''': m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
<br />
'''Difficulty''': difficult<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
'''Required skills''': knowledge of C++ and C since most libraries are written in those languages<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Summer_of_Code_-_Getting_Started&diff=8226Summer of Code - Getting Started2016-03-01T09:23:29Z<p>Cdf: /* Numerical */</p>
<hr />
<div>The following is distilled from the [[Projects]] page for the benefit of potential [https://www.google-melange.com/gsoc/homepage/google/gsoc2015 Google] and [http://sophia.estec.esa.int/socis2015 ESA] Summer of Code (SoC) 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.<br />
<br />
= Steps Toward a Successful Application =<br />
<br />
If you like any of the projects described below, these are the steps you need to follow to apply:<br />
<br />
* '''Help Us Get To Know You'''<br><br />
: If you aren't communicating with us before the application is due, your application will not be accepted.<br />
:: '''Join the [https://lists.gnu.org/mailman/listinfo/octave-maintainers maintainers mailing list]''' or read the archives and see what topics we discuss and how the developers interact with each other.<br />
:: '''Hang out in our [https://webchat.freenode.net/?channels=#octave IRC channel]'''. Ask questions, show us that you are motivated and well-prepared. There will be more applicants than we can effectively mentor, so do ask for feedback on your public application to increase the strength of your proposal!<br />
* '''Find Something That Interests You'''<br />
: It's '''critical''' that you '''find a project that excites you'''. You'll be spending most of the summer working on it (we expect you to treat the SoC as a full-time job).<br />
: Don't just tell us how interested you are, show us that you're willing and able to '''contribute''' to Octave. You can do that by [https://savannah.gnu.org/bugs/?group=octave fixing a few bugs] or [http://savannah.gnu.org/patch/?group=octave submitting patches] well before the deadline, in addition to regularly interacting with Octave maintainers and users on e-mail and IRC. Our experience shows us that successful SoC students demonstrate their interest early and often.<br />
* '''Prepare Your Proposal With Us'''<br />
: By working with us to prepare your proposal, you'll be getting to know us and showing us how you approach problems. The best place for this is your Wiki user page and the [https://webchat.freenode.net/?channels=#octave IRC channel].<br />
* '''Complete Your Application'''<br />
: Fill out our '''''public''''' application template.<br />
:: This is best done by '''[[Special:CreateAccount|creating an account at this wiki]]''', and copying the '''[[Template:Student_application_template_public|template]]''' from its page.<br />
:: You really only need to copy and answer the '''''public''''' part there, there is no need to showcase everything else to everybody reading your user page!<br />
: Fill out our '''''private''''' application template.<br />
:: This is best done by copying the '''[[Template:Student_application_template_private|template]]''' from its page and '''adding the required information to your application at Google (melange)''' or at '''ESA'''.<br><br />
:: Only the organization admin and the possible mentors will see this data. You can still edit it after submitting until the deadline!<br />
<br />
== Things You'll be Expected to Know or Quickly Learn ==<br />
<br />
Octave is mostly written in C++ and its own scripting language that is mostly compatible with Matlab. 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 Octave's scripting language, successful applicants will be familiar with or able to quickly learn about Octave's infrastructure. You can't spend the whole summer learning how to build Octave or prepare a changeset and still successfully complete your project.<br />
<br />
* '''The Build System'''<br />
: [http://en.wikipedia.org/wiki/GNU_build_system The GNU build system] is used to build Octave.<br />
: 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.<br />
: If you've ever done a <tt>configure && make && make install</tt> series of commands, you have already used the GNU build system.<br />
: '''You must demonstrate that you are able to build the development version of Octave from sources before the application deadline.'''<br />
* '''The Version Control System'''<br />
: We use [http://mercurial.selenic.com/ Mercurial] (abbreviated hg).<br />
: Mercurial is the [http://en.wikipedia.org/wiki/Distributed_Version_Control_System 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.<br />
* '''The Procedure for Contributing Changesets'''<br />
: You will be expected to follow the same procedures as other contributors and core developers.<br />
: You will be helping current and future Octave developers by using our standard style for changes, commit messages, and so on. You should also read the same [https://www.gnu.org/software/octave/doc/interpreter/Contributing-Guidelines.html contribution] [http://hg.savannah.gnu.org/hgweb/octave/file/tip/etc/HACKING guidelines] we have for everyone.<br />
: [[Hg_instructions_for_mentors#Mercurial_Tips_for_SoC_students | This page]] describes the procedures students are expected to use to publicly display their progress in a public mercurial repo during their work.<br />
* '''The Maintainers Mailing List'''<br />
: We primarily use [https://lists.gnu.org/mailman/listinfo/octave-maintainers mailing lists] for communication among developers.<br />
: The mailing list is used most often for discussions about non-trivial changes to Octave, or for setting the direction of development.<br />
: You should follow basic mailing list etiquette. For us, this mostly means "do not [https://en.wikipedia.org/wiki/Posting_style#Top-posting top post]".<br />
* '''The IRC Channel'''<br />
: We also have [http://webchat.freenode.net?channels=octave the #octave IRC channel in Freenode].<br />
: You should be familiar with the IRC channel. It's very helpful for new contributors (you) to get immediate feedback on ideas and code.<br />
: Unless your primary mentor has a strong preference for some other method of communication, the IRC channel will likely be your primary means of communicating with your mentor and Octave developers.<br />
* '''The Octave Forge Project'''<br />
: [http://octave.sf.net Octave-Forge] is a collection of contributed packages that enhance the capabilities of core Octave. They are somewhat analogous to Matlab's toolboxes.<br />
* '''Related Skills'''<br />
: In addition, you probably should know '''some''' mathematics, engineering, experimental science, or something of the sort.<br />
: If so, you probably have already been exposed to the kinds of problems that Octave is used for.<br />
<br />
== Criteria by which applications are judged ==<br />
<br />
These might vary somewhat depending on the mentors and coordinators for a particular Summer of Code, but typically the main factors considered would be:<br />
<br />
* '''Applicant has demonstrated an ability to make substantial modifications to Octave'''<br />
: The most important thing is that you've contributed some interesting code samples to judge you by. It's OK during the application period to ask for help on how to format these code samples, which normally are Mercurial patches.<br />
<br />
* '''Applicant shows understanding of topic'''<br />
: Your application should make it clear that you're reasonably well versed in the subject area and won't need all summer just to read up on it.<br />
<br />
* '''Applicant shows understanding of and interest in Octave development'''<br />
: The best evidence for this is previous contributions and interactions.<br />
<br />
* '''Well thought out, adequately detailed, realistic project plan'''<br />
: "I'm good at this, so trust me" isn't enough. You should describe which algorithms you'll use and how you'll integrate with existing Octave code. You should also prepare a full timeline and goals for the midterm and final evaluations.<br />
<br />
= Suggested projects =<br />
<br />
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.<br />
<br />
{{Note|these are suggested projects but you are welcome to propose your own projects provided you find an Octave mentor}}<br />
<br />
== Numerical ==<br />
<br />
These projects involve implementing certain mathematical functions in Octave.<br />
<br />
=== Matlab Compatible DAE solver ===<br />
<br />
The goal is to implement a Matlab compatible adaptive BDF solver for Differential Algebraic Equations (DAEs).<br />
The interface would need to be compatible with ode15s while for the backend the <br />
[https://computation.llnl.gov/casc/sundials/main.html SUNDIALS] library would be used, which has both a C and a MEX interface.<br />
This function should eventually be included in Octave core together with the other [http://hg.savannah.gnu.org/hgweb/octave/file/tip/scripts/ode/ ODE solvers] that will be released with version 4.2, but could be intially developed as an addition to the [https://sourceforge.net/p/octave/odepkg/ci/default/tree/ odepkg] package.<br />
<br />
'''Required skills''': C++; C; familiarity with numerical methods for DAEs; Basic knowledge of makefiles and/or autotools.<br />
'''Difficulty''': medium.<br />
'''Potential mentors''': Carlo de Falco, Marco Caliari, Jacopo Corno, Sebastian Schöps<br />
<br />
=== Improve logm, sqrtm, funm ===<br />
<br />
The goal here is to implement some missing Matlab functions related to matrix functions like the [http://en.wikipedia.org/wiki/Matrix_exponential matrix exponential]. There is [http://octave.1599824.n4.nabble.com/matrix-functions-td3137935.html a general discussion] of the problem. A good starting point for available algorithms and open-source implementations is Higham and Deadman's [http://eprints.ma.man.ac.uk/2102/01/covered/MIMS_ep2014_8.pdf "A Catalogue of Software for Matrix Functions"].<br />
<br />
'''Potential mentor''': Jordi Gutiérrez Hermoso<br />
<br />
=== Generalised eigenvalue problem ===<br />
<br />
[http://www.mathworks.com/help/techdoc/ref/eig.html Certain calling forms] of the <tt>eig</tt> function are currently missing, including preliminary balancing; computing left eigenvectors as a third output; and choosing among generalized eigenvalue algorithms. See also [http://octave.1599824.n4.nabble.com/General-eigenvalue-problem-proposal-td4651990.html this discussion]. <br />
<br />
'''Required skills''': C++; familiarity with numerical linear algebra and LAPACK.<br />
<br />
'''Difficulty''': medium.<br />
<br />
'''Potential mentor''': Nir Krakauer<br />
<br />
=== TISEAN package ===<br />
<br />
[http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/index.html TISEAN] is a suite of code for nonlinear time series analysis. It has have been [http://wiki.octave.org/TISEAN_package partially re-implemented] as libre software. The objective is to integrate TISEAN as an octave package as it was done for the Control package.<br />
[[TISEAN_package | Lot has been completed]] but [[TISEAN_package:Procedure | there is still work left to do]].<br />
<br />
There missing functions to do computations on spike trains, to simulate autoregresive models, to create specialized plots, etc. Do check [[TISEAN_package:Procedure#Table_of_functions|the progress of the project]] to see if you are interested.<br />
<br />
* [http://octave.sourceforge.net/tisean/overview.html Package help at source forge.] <br />
* [https://sourceforge.net/p/octave/tisean/ci/default/tree/ Package repository at source forge.] <br />
<br />
'''Required skills''': m-file scripting, c/C++ and FORTRAN API knowledge. <br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': [[User:KaKiLa]]<br />
<br />
=== Symbolic package ===<br />
<br />
Octave's [https://github.com/cbm755/octsympy Symbolic package] handles symbolic computing and other CAS tools. The main component of Symbolic is a pure m-file class "@sym" which uses the Python package [https://www.sympy.org SymPy] to do (most of) the actual computations. The package aims to expose the full functionality of SymPy while also providing a high-level of compatibility with the Matlab Symbolic Math Toolbox. Currently, communication between Octave and Python is handled with a pipe (see "help popen2") and parsing text. However, this is fragile when things go wrong: for example, catching exceptions from Python is a bit ad hoc.<br />
<br />
The main aim of this proposed project is to implement (or even better co-opt an existing) C/C++ oct-file interface that interacts with Python as a library, and e.g., deals gracefully with exceptions. This could either supplement the existing IPC or replace it altogether.<br />
<br />
'''Required skills''': m-file scripting, C/C++, and Python<br />
<br />
'''Difficulty''': easy/medium<br />
<br />
'''Mentor''': Colin B. Macdonald<br />
<br />
=== Interval package ===<br />
<br />
The [[Interval_package|interval package]] provides several arithmetic functions with accurate and guaranteed error bounds. Its development started in the end of 2014 and there is some fundamental functionality left to be implemented. See the [http://octave.sourceforge.net/interval/overview.html list of functions], basically any missing numeric Octave function could be implemented as an interval extension in the package. If the student has previous knowledge in interval analysis, it is also possible to implement such missing algorithms (as m-files) or improve the existing algorithms. <br />
<br />
'''Required skills''': m-file scripting, basic knowledge of computer arithmetics (especially floating-point computations), interval analysis (depending on the functions to implement)<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Mentor''': [[User:oheim|Oliver Heimlich]]<br />
<br />
=== Improve iterative methods for sparse linear systems ===<br />
<br />
GNU Octave currently has the following Krylov subspace methods for sparse linear systems: pcg (spd matrices) and pcr (Hermitian matrices), bicg,<br />
bicgstab, cgs, gmres, and qmr (general matrices). Their descriptions and their error messages are not aligned. Moreover, they have similar blocks of code (input check for instance) which can be written once and for all in common functions. The first step in this project could be a revision<br />
and a synchronization of the codes.<br />
<br />
In Matlab, some additional methods are available: minres and symmlq (symmetric matrices), tfqmr and bicgstabl (generale matrices), lsqr (least<br />
squares). The second step in this project could be the implementation of some of these missing functions.<br />
<br />
The reference book is available here<br />
www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf<br />
<br />
'''Mentor''': Marco Caliari<br />
<br />
== Infrastructure ==<br />
<br />
=== Octave Package management ===<br />
<br />
Octave management of installed packages is performed by a single function, {{codeline|pkg}}, which does pretty much everything. This function has a few limitations which are hard to implement with the current codebase, and will most likely require a full rewrite.<br />
<br />
The planned improvements are:<br />
<br />
* support for multiple Octave installs<br />
* support for multiple version packages<br />
* support for system-wide and user installed packages<br />
* automatic handling of dependencies<br />
* more flexibility on dependencies, e.g., dependent on specific Octave build options or being dependent in one of multiple packages<br />
* management of tests and demos in C++ sources of packages<br />
* think ahead for multiple <br />
* easily load or check specific package versions<br />
<br />
The current {{codeline|pkg}} also performs some functions which probably should not. Instead a package for developers should be created with such tools.<br />
<br />
Many of these problems have been solved in other languages. Familiarity with how other languages handle this problem will be useful to come up with elegant solutions. In some cases, there are standards to follow. For example, there are specifications published by freedesktop.org about where files should go ([http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html base directory spec]) and Windows seems to have its own standards. See bugs {{bug|36477}} and {{bug|40444}} for more details.<br />
<br />
In addition, package names may start to collide very easily. One horrible way to workaround this by is choosing increasingly complex package names that give no hint on the package purpose. A much better is option is providing an Authority category like Perl 6 does. Nested packages is also an easy way to provide packages for specialized subjects (think {{codeline|image::morphology}}). A new {{codeline|pkg}} would think all this things now, or allow their implementation at a later time. Read the [[OEP:pkg|unfinished plan]] for more details.<br />
<br />
'''Minimum requirements''': Ability to read and write Octave code, experience with Octave packages, and understanding of the basics of autotools. The most important skill is software design.<br />
<br />
'''Difficulty''': Easy to Medium<br />
<br />
'''Mentor''': Carnë Draug<br />
<br />
== Image Analysis ==<br />
<br />
=== Improvements to N-dimensional image processing ===<br />
<br />
The image package has partial functionality for N-dimensional images. These images exist for example in medical imaging where slices from scans are assembled to form anatomical 3D images. If taken over time and at different laser wavelengths or light filters, they can also result in 5D images. Albeit less common, images with even more dimensions also exist. However, their existence is irrelevant since most of the image processing operations are mathematical operations which are independent of the number of dimensions.<br />
<br />
As part of GSoC 2013, the core functions for image IO, {{codeline|imwrite}} and {{codeline|imread}}, were extended to better support this type of images. Likewise, many functions in the image package, mostly morphology operators, were expanded to deal with this type of image. Since then, many other functions have been improved, sometimes completely rewritten, to abstract from the number of dimensions. In a certain way, supporting ND images is also related to choosing good algorithms since such large images tend to be quite large.<br />
<br />
This project will continue on the previous work, and be mentored by the previous GSoC student and current image package maintainer. Planning the project requires selection of functions lacking ND support and identifying their dependencies. For example, supporting {{codeline|imclose}} and {{codeline|imopen}} was better implemented by supporting {{codeline|imerode}} and {{codeline|imdilate}} which then propagated ND support to all of its dependencies. These dependencies need to be discovered first since often they are not being used yet, and may even be missing function. This project can also be about implementing functions that have [http://wiki.octave.org/Image_package#Missing_functions not yet been implemented]. Also note that while some functions in the image package will accept ND images as input, they are actually not correctly implemented and will give incorrect results.<br />
<br />
'''Required skills''': m-file scripting, and a fair amount of C++ since a lot of image analysis cannot be vectorized. Familiarity with common CS algorithms and willingness to read literature describing new algorithms will be useful. <br />
<br />
'''Difficulty''': difficult<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
=== Improve Octave's image IO ===<br />
<br />
There are a lot of image formats. To handle this, Octave uses [http://www.graphicsmagick.org/ GraphicsMagic] (GM), a library capable of handling [http://www.graphicsmagick.org/formats.html a lot of them] in a single C++ interface. However, GraphicsMagick still has its limitations. The most important are:<br />
<br />
* GM has build option {{codeline|quantum}} which defines the bitdepth to use when reading an image. Building GM with high quantum means that images of smaller bitdepth will take a lot more memory when reading, but building it too low will make it impossible to read images of higher bitdepth. It also means that the image needs to always be rescaled to the correct range.<br />
* GM supports unsigned integers only thus incorrectly reading files such as TIFF with floating point data<br />
* GM hides away details of the image such as whether the image file is indexed. This makes it hard to access the real data stored on file.<br />
<br />
This project would implement better image IO for scientific file formats while leaving GM handle the others. Since TIFF is the de facto standard for scientific images, this should be done first. Among the targets for the project are:<br />
<br />
* implement the Tiff class which is a wrap around libtiff, using classdef. To avoid creating too many private __oct functions, this project could also create a C++ interface to declare new Octave classdef functions.<br />
* improve imread, imwrite, and imfinfo for tiff files using the newly created Tiff class<br />
* port the bioformats into Octave and prepare a package for it<br />
* investigate other image IO libraries<br />
* clean up and finish the dicom package to include into Octave core<br />
* prepare a matlab compatible implementation of the FITS package for inclusion in Octave core<br />
<br />
'''Required skills''': knowledge of C++ and C since most libraries are written in those languages<br />
<br />
'''Difficulty''': medium<br />
<br />
'''Potential mentor''': Carnë Draug<br />
<br />
<noinclude><br />
[[Category:Summer of Code]]<br />
[[Category:Project Ideas]]<br />
</noinclude></div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Move_some_ODE_package_functions_from_Octave-Forge_to_core&diff=7000Move some ODE package functions from Octave-Forge to core2015-12-12T14:19:38Z<p>Cdf: /* Files */</p>
<hr />
<div>== Introduction ==<br />
<br />
Parts of the ODE package have recently been incorporated into core. However, there are several more functions which should be shifted from the ODE. The core is much stricter about coding conventions which requires rigorous cleaning of the files before they are introduced to the core.<br />
<br />
== Conversion Tasks ==<br />
<br />
# Copy over GNU public license statement from any existing core m-file to start of file.<br />
# Update Copyright statement at head of file.<br />
# Replace all single quotes (') with double quotes (").<br />
# Replace logical not operator (~) with the not operator (!).<br />
# Replace '%' comment character with '#'. Use '##' to precede comments which stand alone on a line. Use '#" for comments on the same line as code.<br />
# Make sure all uses of "end" are keyword specific such as endif, endfor, endwhile, etc.<br />
# Use 2 spaces for each indent level. Replace all tabs with spaces.<br />
# Delete 'v' used as first character for all variables. For example, a variable "vtmp" should just be written as "tmp"<br />
# Try to lowercase or rename any CamelCase variables.<br />
# Replace "OdePkg:" error ID with "Octave:".<br />
# Preface error messages with "FUNCTION_NAME:". For example, the following is in ode45.m: error ("Octave:invalid-input-arg", "ode45: TRANGE must be a numeric vector");<br />
# Match variable names described in documentation to those used in the function header. For example, in ode45.m the documentation is "## @deftypefn {Function File} {[@var{t}, @var{y}] =} ode45 (@var{fun}, @var{trange}, @var{init})" and the function prototype is "function varargout = ode45 (fun, trange, init, varargin)"<br />
# Potentially update @seealso links in other m-files to link to the new file.<br />
# Add %!demo or BIST %!test blocks below "endfunction" keyword. There should be two newlines between "endfunction" and the start of any '%!' blocks.<br />
# Potentially remove the newly implemented function from scripts/help/__unimplemented__.m.<br />
# Add new m-file to appropriate location in scripts/ode/module.mk.<br />
# Consider adding a @DOCSTRING(FUNCTION_NAME) entry in the appropriate location in doc/interpreter/diffeq.txi.<br />
<br />
<br />
The list of files to move from the ODE package is shown in the Files section of this page. To avoid duplication, sign up for a particular file by editing the Files section of this wiki page and adding your name next to the file. When you have finished converting a file, let a Maintainer know so that we can check in the changes. Also, add the wiki tags <pre><strike> ... </strike></pre> to the Files section to cross the file off the list.<br />
<br />
== Files ==<br />
<br />
* <strike>odeplot.m (Stefan Miereis)</strike> (Patch submitted) (Patch pushed) (Removed from odepkg)<br />
* ode23.m (Stefan Miereis)<br />
* runge_kutta_23.m<br />
<br />
== Changes to odepkg to maintain compatibility with new release ==<br />
<br />
As part of the inclusion in core of ODE solvers, <br />
some private functions or other sorts of utility<br />
functions are being moved to core as well.<br />
<br />
Some changes made in order to adapt these functions<br />
to the coding style in core may break compatibility<br />
with solvers that will remain in odepkg, so the latter<br />
need to be adapted as well.<br />
<br />
* remove prefix 'v' from field names in options structs<br />
* input and output arguments of the steppers should be made compliant to the call in integrate_adaptive.m. The main example in core is runge_kutta_45_dorpri.m</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Code_Sprint_(2015-12-12)&diff=6994Code Sprint (2015-12-12)2015-12-12T13:49:46Z<p>Cdf: /* Attendees */</p>
<hr />
<div>The worldwide Octave community will be holding a code sprint this December.<br />
<br />
'''When1:''' December 12th, 14:00 UTC.<br />
<br />
'''When2:''' Darmstadt (15:00), London (14:00), Philadelphia (09:00), San Francisco (06:00)<br />
<br />
'''Where:''' Octave IRC channel, #octave. See [[IRC]].<br />
<br />
A code sprint is an opportunity for programmers to get together for both coding and socializing.<br />
We will have some goals, the sprint topics shown below, to guide our sprint, but anyone is welcome to hang out and work on their own special topic.<br />
There will be multiple Octave Maintainers attending so this is also a good chance to get introduced to the Octave code base and how to make patches for it.<br />
In order to contribute you should have installed Mercurial, fetched the development sources, and have successfully built your own local copy of Octave.<br />
See [http://www.gnu.org/software/octave/get-involved.html Getting Involved].<br />
<br />
== Sprint Topics ==<br />
# [[Refactor C++ code that uses print_usage() to resemble m-files]]<br />
# [[Add BIST tests for octave functions written in C++]]<br />
# [[Remove class of function from documentation strings]]<br />
# [[Move some ODE package functions from Octave-Forge to core]]<br />
# [[Refactor C++ code to eliminate useless return statements after error()]]<br />
# [[Refactor C++ code to use ovl() when returning multiple values]]<br />
<br />
== Attendees ==<br />
<br />
* Rik<br />
* [[User:Mtmiller|Mike Miller]] (mtmx)<br />
* [[User:jwe|John W. Eaton]] (jwe)<br />
* Hugh Mayfield (hugh/hlam)<br />
* [https://savannah.gnu.org/users/stefanm Stefan Miereis]<br />
* [[User:andy1978|Andreas Weber]] (andy1978)<br />
* [[User:cdf|Carlo de Falco]] (cdf)<br />
[[Category:Releases]]</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Move_some_ODE_package_functions_from_Octave-Forge_to_core&diff=6950Move some ODE package functions from Octave-Forge to core2015-12-07T08:32:35Z<p>Cdf: /* Changes to odepkg to maintain compatibility with new release */</p>
<hr />
<div>== Introduction ==<br />
<br />
Parts of the ODE package have recently been incorporated into core. However, there are several more functions which should be shifted from the ODE. The core is much stricter about coding conventions which requires rigorous cleaning of the files before they are introduced to the core.<br />
<br />
== Conversion Tasks ==<br />
<br />
# Copy over GNU public license statement from any existing core m-file to start of file.<br />
# Update Copyright statement at head of file.<br />
# Replace all single quotes (') with double quotes (").<br />
# Replace logical not operator (~) with the not operator (!).<br />
# Replace '%' comment character with '#'. Use '##' to precede comments which stand alone on a line. Use '#" for comments on the same line as code.<br />
# Make sure all uses of "end" are keyword specific such as endif, endfor, endwhile, etc.<br />
# Use 2 spaces for each indent level. Replace all tabs with spaces.<br />
# Delete 'v' used as first character for all variables. For example, a variable "vtmp" should just be written as "tmp"<br />
# Try to lowercase or rename any CamelCase variables.<br />
# Replace "OdePkg:" error ID with "Octave:".<br />
# Preface error messages with "FUNCTION_NAME:". For example, the following is in ode45.m: error ("Octave:invalid-input-arg", "ode45: TRANGE must be a numeric vector");<br />
# Match variable names described in documentation to those used in the function header. For example, in ode45.m the documentation is "## @deftypefn {Function File} {[@var{t}, @var{y}] =} ode45 (@var{fun}, @var{trange}, @var{init})" and the function prototype is "function varargout = ode45 (fun, trange, init, varargin)"<br />
# Potentially update @seealso links in other m-files to link to the new file.<br />
# Add %!demo or BIST %!test blocks below "endfunction" keyword. There should be two newlines between "endfunction" and the start of any '%!' blocks.<br />
# Potentially remove the newly implemented function from scripts/help/__unimplemented__.m.<br />
# Add new m-file to appropriate location in scripts/ode/module.mk.<br />
# Consider adding a @DOCSTRING(FUNCTION_NAME) entry in the appropriate location in doc/interpreter/diffeq.txi.<br />
<br />
<br />
The list of files to move from the ODE package is shown in the Files section of this page. To avoid duplication, sign up for a particular file by editing the Files section of this wiki page and adding your name next to the file. When you have finished converting a file, let a Maintainer know so that we can check in the changes. Also, add the wiki tags <pre><strike> ... </strike></pre> to the Files section to cross the file off the list.<br />
<br />
== Files ==<br />
<br />
* odeplot.m<br />
<br />
== Changes to odepkg to maintain compatibility with new release ==<br />
<br />
As part of the inclusion in core of ODE solvers, <br />
some private functions or other sorts of utility<br />
functions are being moved to core as well.<br />
<br />
Some changes made in order to adapt these functions<br />
to the coding style in core may break compatibility<br />
with solvers that will remain in odepkg, so the latter<br />
need to be adapted as well.<br />
<br />
* remove prefix 'v' from field names in options structs</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Move_some_ODE_package_functions_from_Octave-Forge_to_core&diff=6949Move some ODE package functions from Octave-Forge to core2015-12-07T08:28:33Z<p>Cdf: </p>
<hr />
<div>== Introduction ==<br />
<br />
Parts of the ODE package have recently been incorporated into core. However, there are several more functions which should be shifted from the ODE. The core is much stricter about coding conventions which requires rigorous cleaning of the files before they are introduced to the core.<br />
<br />
== Conversion Tasks ==<br />
<br />
# Copy over GNU public license statement from any existing core m-file to start of file.<br />
# Update Copyright statement at head of file.<br />
# Replace all single quotes (') with double quotes (").<br />
# Replace logical not operator (~) with the not operator (!).<br />
# Replace '%' comment character with '#'. Use '##' to precede comments which stand alone on a line. Use '#" for comments on the same line as code.<br />
# Make sure all uses of "end" are keyword specific such as endif, endfor, endwhile, etc.<br />
# Use 2 spaces for each indent level. Replace all tabs with spaces.<br />
# Delete 'v' used as first character for all variables. For example, a variable "vtmp" should just be written as "tmp"<br />
# Try to lowercase or rename any CamelCase variables.<br />
# Replace "OdePkg:" error ID with "Octave:".<br />
# Preface error messages with "FUNCTION_NAME:". For example, the following is in ode45.m: error ("Octave:invalid-input-arg", "ode45: TRANGE must be a numeric vector");<br />
# Match variable names described in documentation to those used in the function header. For example, in ode45.m the documentation is "## @deftypefn {Function File} {[@var{t}, @var{y}] =} ode45 (@var{fun}, @var{trange}, @var{init})" and the function prototype is "function varargout = ode45 (fun, trange, init, varargin)"<br />
# Potentially update @seealso links in other m-files to link to the new file.<br />
# Add %!demo or BIST %!test blocks below "endfunction" keyword. There should be two newlines between "endfunction" and the start of any '%!' blocks.<br />
# Potentially remove the newly implemented function from scripts/help/__unimplemented__.m.<br />
# Add new m-file to appropriate location in scripts/ode/module.mk.<br />
# Consider adding a @DOCSTRING(FUNCTION_NAME) entry in the appropriate location in doc/interpreter/diffeq.txi.<br />
<br />
<br />
The list of files to move from the ODE package is shown in the Files section of this page. To avoid duplication, sign up for a particular file by editing the Files section of this wiki page and adding your name next to the file. When you have finished converting a file, let a Maintainer know so that we can check in the changes. Also, add the wiki tags <pre><strike> ... </strike></pre> to the Files section to cross the file off the list.<br />
<br />
== Files ==<br />
<br />
* odeplot.m<br />
<br />
== Changes to odepkg to maintain compatibility with new release ==</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=6676Ocs package2015-09-22T10:52:34Z<p>Cdf: /* History and Motivation */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
<br />
OCS was developed during the CoMSON (Coupled Multiscale Simulation and Optimization) project which involved several universities but also several industrial partners.<br />
<br />
Each of the industrial partners at the time was using its own circuit simulation software and each software had different file formats for circuit netlists.<br />
<br />
Given the purposes of the project and the composition of the consortium the main design objectives for OCS where<br />
<br />
* provide a format for "element evaluators" independent of time-stepping algorithms<br />
* provide a "hierarchical" data structure where elements could be composed themselves of lumped-element networks<br />
* allow coupling of lumped-element networks (0D) and 1D/2D/3D device models<br />
* use an intermediate/interchange file format so that none of the formats in use by the industrial partners would be favoured over the others<br />
* be written in an interpreted language for quick prototyping and easy maintainance<br />
* be Free Software<br />
<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , m(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (KaKiLa, can you please add a reference to the paper?)<br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=6673Ocs package2015-09-22T10:43:29Z<p>Cdf: /* Problem Formulation */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N <br />
\end{array}<br />
</math><br />
<br />
<math><br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0 \qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , m(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (KaKiLa, can you please add a reference to the paper?)<br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=6672Ocs package2015-09-22T10:42:37Z<p>Cdf: /* Problem Formulation */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\begin{array}{l}<br />
{n} = 1, \, \ldots \, ,N \\ <br />
B_{mi} \dot{{r}}_{m} +<br />
Q_{mi}\ \left( {e}, {r}_{m} \right) = 0.<br />
\end{array}<br />
</math><br />
<br />
<math><br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for each element of the block<br />
vnmatrix % numbers of the external variables of each element<br />
nintvar % number of internal variables for each element of the block<br />
osintvar % number of the first internal variable<br />
npar % number of parameters<br />
nparnames% number of parameter names<br />
nrows % number of rows in the block<br />
parnames % list of parameter names<br />
pvmatrix % list of parameter values for each element<br />
<br />
}<br />
</syntaxhighlight>}}<br />
<br />
== File Formats ==<br />
<br />
There are several ways of setting up the data structure for an OCS simulation.<br />
The first approach is to just assign the fields of the data structure via Octave commands,<br />
otherwise one can parse an ascii file written in (a subste of) SPICE netlist language or<br />
in OCS's own netlist specification language called IFF (Interchange File Format)<br />
<br />
=== IFF netlists ===<br />
<br />
The name IFF stands for "Intermediate File Format" or "Interchange File Format" it represents an ASCII file format for describing coupled electrical circuits, devices and systems. The IFF syntx described here is version 0.1b1.<br />
<br />
A circuit description is comprised of a set of files of three different types:<br />
* 1 CIR (Circuit) file: an ASCII text file with filename <circuitname>.cir<br />
* 1 NMS (Names) file: an ASCII text file with filename <circuitname>.nms<br />
* N >= 1 SBN (Subnet) files: a set of M-functions or DLD-functions following the template described below.<br />
<br />
SBN files are not necessarily specific to one circuit and can be grouped in libraries as long as the directory containing the library is added to the path when the IFF parser is run.<br />
<br />
==== CIR file ====<br />
<br />
The CIR file is divided into two sections describing the linear time–independent (LCR = linear circuit) and the non–linear and/or time–dependent (NLC = non–linear circuit) partitions of the circuit respectively. The syntax for the LCR and NLC section is identical. NLC can also contain linear elements, in fact the whole circuit could be described only by the NLC section but this could result in the evaluator unnecessarily recomputing local matrices for linear time–independent elements The content of CIR files is organized as follows:<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir := header nlc separator lcr separator ;<br />
header := '%' version_id '$\nl$' <br />
comment* ;<br />
comment:= '%' text '$\nl$' ;<br />
nlc := block* ;<br />
block := blockcomment? blockheader pv_matrix vnum_matrix ;<br />
block_comment := '%' text '$\nl$' ;<br />
block_header := func section n_extvar n_par '$\nl$' <br />
n_rows n_parnames '$\nl$' <br />
par_name*;<br />
section := string ; <br />
n_extvar := number ; <br />
n_par := number ; <br />
n_rows := number ;<br />
n_parnames := number ;<br />
par_name := string ; <br />
pv_matrix := matrix ;<br />
vnum_matrix := matrix ;<br />
matrix := number+ ; <br />
separator := 'END $\nl$' ; <br />
lcr := block* ;<br />
</syntaxhighlight>}}<br />
<br />
<br />
where <br />
* "version_id" is a string identifying the version on IFF in which the file is encoded<br />
* "\n" is the new-line character string that represents anything that the Octave command "s=fscanf(file,%s)" would parse as a string i.e. any sequence of chars without white-space<br />
* "text" is any sequence of chars without a \n, this differs from string because it can contain white–space number represents anything that the Octave command "s=fscanf(file,%g)" would parse as a number<br />
* "func" is the name of a function to evaluate the elements described in the block<br />
* "n_extvar" Is the number of external variables for the elements of a block<br />
* "n_par" Is the number of parameters for the elements of a block<br />
* "n_rows" Is the number of elements in a block<br />
* n_parnames" Is the number of parameter names for the elements of a block, it corresponds to the number of par name entries. If "n_parnames" is 0 the line with the "par_names" is missing.<br />
* "pv_matrix" Is a list of n_rows x n_par numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider whitespace (including "\n"). Every row (a set of n par contiguous entries) in "pv_matrix" refers to an element of the circuit. The "n_par" numbers in a row represent the values of the parameters to be passed to the function that evaluates that element.<br />
* "vnum_matrix" Is a list of "n_rows" x "n_extvar" numbers separated by any character the Octave command "s=fscanf(file,%g)" would consider white-space (including \n). Every row (a set of "n_extvar" contiguous entries) in "vnum_matrix" refers to an element of the circuit. The "n_extvar" numbers in the row represent the global numbering of the element external variables.<br />
<br />
==== NMS files ====<br />
<br />
NMS files are meant to contain the names of the circuit variables, the format of NMS is<br />
just a list of variable names one on each row preceded by the variable number:<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
nms := version id ’\n’ comment∗ line∗ ; line := var number var name ;<br />
var number := number ;<br />
var name := string ;<br />
</syntaxhighlight>}}<br />
<br />
the variable are ordered as follows:<br />
* first all external variables of all elements in the order given by the global numbering of external variables as explicitly written in the CIR files<br />
* then the internal variables of the elements in the same order as the corresponding elements appear in the CIR file ( internal variables of non-linear elements first, then those of linear elements)<br />
<br />
Notice that the number of internal variables of each element is not included in the IFF files. This is because elements with a number of internal variables that is huge, that depends on the value of some parameter, or even that changes in time (for example distributed elements treated with a FEM with adaptive meshing, a large linear sub- circuit that is reduce via MOR...) and therefore it is more convenient to compute the number of internal variables when initializing the system.<br />
<br />
<br />
==== SBN files ====<br />
<br />
SBN files are Octave functions, implemented as M-scripts or as DLD functions,<br />
with the following signature<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a, b, c] =...<br />
func (string , m(i ,:) , extvar , intvar , t)<br />
</syntaxhighlight>}}<br />
i.e. it should get as inputs:<br />
* the string entry of the "block_header"<br />
* one row of the "pv_matrix" entry of the "block"<br />
* the current values of all internal and external variables <br />
* the current time<br />
and it should produce as outputs three matrices:<br />
* <math>a, b \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}}) <br />
\times ({n_{extvar}} + {n_{intvar})}}</math><br />
* <math>c \in \mathbb{R}^{({n_{extvar}} + {n_{intvar}})}</math><br />
where "n_intvar" is the number of internal variables that can be assembled in the complete system matrices.<br />
<br />
=== SPICE netlists ===<br />
<br />
SPICE .spc netlists are parsed via the function "prs_spice", which currently supports the set of "Element Cards"<br />
shown below with their instantiating syntax.<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="text" style="font-size:13px"><br />
- Capacitors:<br />
Cname n+ n- cvalue<br />
<br />
- Diodes:<br />
Cname anode knode modelname <parameters><br />
<br />
- MOS:<br />
Mname gnode dnode snode bnode modelname <parameters><br />
<br />
N.B.: one instance of a MOS element MUST be preceeded<br />
(everywhere in the file) by the declaration of the related<br />
model. For instance:<br />
.MODEL mynmos NMOS( k=1e-4 Vth=0.1 rd=1e6)<br />
M2 Vgate 0 Vdrain 0 mynmos<br />
<br />
- Resistors:<br />
Rname n+ n- rvalue<br />
<br />
- Voltage sources:<br />
Vname n+ n- <dcvalue> <transvalue><br />
<br />
Transvalue specifies a transient voltage source<br />
SIN(VO VA FREQ TD THETA)<br />
where:<br />
* VO (offset)<br />
* VA (amplitude)<br />
* FREQ (frequency)<br />
* TD (delay)<br />
* THETA (damping factor)<br />
<br />
* 0 to TD: V0<br />
* TD to TSTOP: VO +<br />
VA*exp(-(time-TD)*THETA)*sine(twopi*FREQ*(time+TD))<br />
<br />
Currently the damping factor has no effect.<br />
<br />
Pulse<br />
PULSE(V1 V2 TD TR TF PW PER)<br />
<br />
parameters meaning<br />
* V1 (initial value)<br />
* V2 (pulsed value)<br />
* TD (delay time)<br />
* TR (rise time)<br />
* TF (fall time)<br />
* PW (pulse width)<br />
* PER (period)<br />
<br />
Currently rise and fall time are not implemented yet.<br />
<br />
- .MODEL cards Defines a model for semiconductor devices<br />
<br />
.MODEL MNAME TYPE(PNAME1=PVAL1 PNAME2=PVAL2 ... )<br />
<br />
TYPE can be:<br />
* NMOS N-channel MOSFET model<br />
* PMOS P-channel MOSFET model<br />
* D diode model<br />
<br />
The parameter "LEVEL" is currently assigned to the field<br />
"section" in the call of the element functions by the solver.<br />
Currently supported values for the parameter LEVEL for NMOS<br />
and PMOS are:<br />
* simple<br />
* lincap<br />
(see documentation of function Mdiode).<br />
<br />
Currently supported values for the parameter LEVEL for D are:<br />
* simple<br />
(see documentation of functions Mnmosfet and Mpmosfet).<br />
<br />
</syntaxhighlight>}}<br />
<br />
== Tutorials ==<br />
<br />
=== A CMOS AND GATE ===<br />
<br />
[[File:AND_BW.png|thumb| Schematic for a CMOS AND gate]]<br />
<br />
Here we show how to set up the simulation of the CMOS AND gate in the figure.<br />
The circuit has <br />
* 9 Elements<br />
** 6 MOSFETs (3 n-type + 3 p-type)<br />
** 3 Voltage sources<br />
<br />
For the n-type MOSFETs we use a very simple algebraic model defined by the following code<br />
<br />
{{Code|Model evaluator file for simple MOSFET models |<syntaxhighlight lang="octave" style="font-size:13px"><br />
function [a,b,c] = Mnmosfet (string, parameters, parameternames, extvar, intvar, t) <br />
<br />
switch string<br />
<br />
case 'simple',<br />
<br />
rd = 1e6;<br />
<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=",...<br />
num2str(parameters(ii)) " ;"]) <br />
endfor<br />
<br />
vg = extvar(1);<br />
vs = extvar(2);<br />
vd = extvar(3);<br />
vb = extvar(4);<br />
<br />
vgs = vg-vs;<br />
vds = vd-vs;<br />
<br />
if (vgs < Vth)<br />
<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds>=0)<br />
<br />
id = k*((vgs-Vth)*vds-(vds^2)/2)+vds/rd;<br />
gm = k*vds;<br />
gd = k*(vgs-Vth-vds)+1/rd;<br />
<br />
elseif ((vgs-Vth)>=(vds))&(vds<0)<br />
<br />
gm = 0;<br />
gd = 1/rd;<br />
id = vds*gd;<br />
<br />
else # (i.e. if 0 <= vgs-vth <= vds)<br />
<br />
id = k*(vgs-Vth)^2/2+vds/rd;<br />
gm = k*(vgs-Vth);<br />
gd = 1/rd;<br />
<br />
endif<br />
<br />
a = zeros(4);<br />
<br />
b = [ 0 0 0 0;<br />
-gm (gm+gd) -gd 0; <br />
gm -(gm+gd) gd 0;<br />
0 0 0 0];<br />
<br />
c = [0 -id id 0]';<br />
break;<br />
<br />
otherwise<br />
<br />
error(["Mnmosfet: unknown option " string]);<br />
<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
The model for the p-type devices is entirely analogous.<br />
<br />
Below we show three methods for constructing the circuit data structure<br />
<br />
* [[Ocs package#Build the AND GATE structure directly| using an Octave script ]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing a .spc file| parsing a SPICE netlist]]<br />
* [[Ocs package#Build the AND gate circuit structure parsing an IFF netlist| parsing an IFF netlist]]<br />
<br />
Once the circuit data structure is loaded the simulation can be started by the following commands<br />
<br />
{{Code|Run the AND gate simulation |<syntaxhighlight lang="octave" style="font-size:13px"><br />
x = [.5 .5 .33 .66 .5 1 0 0 1 ]';<br />
t = linspace (0, .5, 100);<br />
pltvars = {"Va", "Vb", "Va_and_b"};<br />
dmp = .2;<br />
tol = 1e-15;<br />
maxit = 100;<br />
out = tst_backward_euler (outstruct, x, t, tol, maxit, pltvars);<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:AND_result.png|thumb| Result of the CMOS AND gate switching simulation]]<br />
<br />
Click on the figure to the right to see the simulation results<br />
<br />
<br />
<br />
==== Build the AND GATE structure directly ====<br />
<br />
{{Code|Build the AND GATE structure via an Octave script |<syntaxhighlight lang="octave" style="font-size:13px"><br />
## NLC<br />
<br />
# n-type<br />
outstruct.NLC(1).func = "Mnmosfet";<br />
outstruct.NLC(1).section = "simple";<br />
outstruct.NLC(1).nextvar = 4;<br />
outstruct.NLC(1).npar = 3;<br />
outstruct.NLC(1).nparnames = 3;<br />
outstruct.NLC(1).parnames = { "k", "Vth", "rd"};<br />
<br />
outstruct.NLC(1).pvmatrix = [1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07<br />
1.0000e-04 1.0000e-01 1.0000e+07];<br />
<br />
outstruct.NLC(1).vnmatrix = [1 3 4 0<br />
2 0 3 0<br />
4 0 5 0];<br />
<br />
outstruct.NLC(1).nintvar = [0 0 0];<br />
outstruct.NLC(1).osintvar = [0 0 0];<br />
<br />
<br />
# p-type<br />
outstruct.NLC(2).func = "Mpmosfet";<br />
outstruct.NLC(2).section = "simple";<br />
outstruct.NLC(2).nextvar = 4;<br />
outstruct.NLC(2).npar = 3;<br />
outstruct.NLC(2).nparnames = 3;<br />
outstruct.NLC(2).parnames = { "k", "Vth", "rd"};<br />
outstruct.NLC(2).pvmatrix = [-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07<br />
-1.0000e-04 -1.0000e-01 1.0000e+07];<br />
outstruct.NLC(2).vnmatrix = [ 1 6 4 6<br />
2 6 4 6<br />
4 6 5 6];<br />
<br />
outstruct.NLC(2).nintvar = [0 0 0];<br />
outstruct.NLC(2).osintvar = [0 0 0];<br />
<br />
# Va and Vb<br />
<br />
outstruct.NLC(3).func = "Mvoltagesources";<br />
outstruct.NLC(3).section = "sinwave";<br />
outstruct.NLC(3).nextvar = 2;<br />
outstruct.NLC(3).npar = 4;<br />
outstruct.NLC(3).nparnames = 4;<br />
outstruct.NLC(3).parnames = {"Ampl", "f", "delay", "shift"};<br />
outstruct.NLC(3).pvmatrix = [0.50000 1.00000 0.00000 0.50000<br />
0.50000 2.00000 0.25000 0.50000];<br />
outstruct.NLC(3).vnmatrix = [ 1 0<br />
2 0];<br />
outstruct.NLC(3).nintvar = [1 1];<br />
outstruct.NLC(3).osintvar = [0 0];<br />
<br />
## LCR<br />
<br />
# Vdd<br />
outstruct.LCR(1).func = "Mvoltagesources";<br />
outstruct.LCR(1).section = "DC";<br />
outstruct.LCR(1).nextvar = 2;<br />
outstruct.LCR(1).npar = 1;<br />
outstruct.LCR(1).nparnames = 1;<br />
outstruct.LCR(1).parnames = {"V"};<br />
outstruct.LCR(1).pvmatrix = 1;<br />
outstruct.LCR(1).vnmatrix = [6 0];<br />
outstruct.LCR(1).nintvar = 1;<br />
outstruct.LCR(1).osintvar = 2;<br />
<br />
## <br />
<br />
outstruct.namesn = [1 2 5 6 7 8 9];<br />
outstruct.namess = {"Va", "Vb", "Va_and_b", "Vdd", "I1", "I2", "I3"};<br />
outstruct.totextvar = 6;<br />
outstruct.totintvar = 3;<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
==== Build the AND gate circuit structure parsing an IFF netlist ====<br />
<br />
To parse an IFF format netlist of the CMOS AND gate we can use the following command<br />
<br />
{{Code|Load the AND circuit structure parsing an IFF netlist |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_iff ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
The IFF netlist consists of the .cir file named "and.cir" shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.cir file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
% A Simple CMOS AND GATE<br />
%<br />
% N-Mosfets<br />
% There are 3 N-Mosfets<br />
Mnmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1e-4 0.1 1e7<br />
1 3 4 0 <br />
2 0 3 0 <br />
4 0 5 0 <br />
%<br />
% P-Mosfets<br />
Mpmosfet simple 4 3<br />
3 3<br />
k Vth rd<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
-1e-4 -0.1 1e7<br />
1 6 4 6 <br />
2 6 4 6 <br />
4 6 5 6<br />
%<br />
% Input voltage sources<br />
Mvoltagesources sinwave 2 4<br />
2 4<br />
Ampl f delay shift<br />
0.5 1 0.0 0.5<br />
0.5 2 0.25 0.5<br />
1 0 <br />
2 0 <br />
END<br />
%<br />
% Power supply<br />
Mvoltagesources DC 2 1<br />
1 1<br />
V<br />
1<br />
6 0 <br />
END<br />
</syntaxhighlight><br />
}}<br />
<br />
and of the .nms file named "and.nms shown below<br />
<br />
{{Code|IFF netlist for the AND gate (.nms file)|<syntaxhighlight lang="text" style="font-size:13px"><br />
% 0.1b1<br />
1 Va<br />
2 Vb<br />
5 Va_and_b<br />
6 Vdd<br />
7 I1<br />
8 I2 <br />
9 I3<br />
</syntaxhighlight><br />
}}<br />
<br />
==== Build the AND gate circuit structure parsing a .spc file ====<br />
<br />
{{Code|Load the AND circuit structure parsing a .spc file |<syntaxhighlight lang="octave" style="font-size:13px"><br />
outstruct = prs_spice ("and");<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
{{Code| The .spc file for the CMOS AND gate|<syntaxhighlight lang="text" style="font-size:13px"><br />
* AND (simple Algebraic MOS-FET model)<br />
<br />
.MODEL mynmos NMOS(LEVEL=simple k=2.94e-05 Vth=0.08 rd=.957e7)<br />
.MODEL mypmos PMOS( k=-2.94e-05 Vth=-0.08 rd=.957e7)<br />
<br />
M1 Va 3 4 0 mynmos <br />
M2 Vb 0 3 0 mynmos <br />
* nside of the inverter<br />
M3 4 0 Va_and_b 0 mynmos <br />
<br />
M4 Va Vdd 4 Vdd mypmos<br />
M5 Vb Vdd 4 Vdd mypmos<br />
<br />
* pside of the inverter<br />
M6 4 Vdd Va_and_b Vdd mypmos <br />
<br />
V1 Va 0 SIN(0.5 0.5 1 0 0)<br />
V2 Vb 0 SIN(0.5 0.5 2 0.25 0)<br />
V3 Vdd 0 1<br />
<br />
.END<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
=== Creating a model for a memristor device ===<br />
<br />
To demonstrate how to write a model evaluator file (SBN file), we<br />
will discuss the simplest memristor model shown in this paper by [[User:KaKiLa| KaKiLa]] et al. (KaKiLa, can you please add a reference to the paper?)<br />
<br />
The device model is presented in the original paper as<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dot{x} = \mu I(t)\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
V(t) = H(x) I(t)<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
The first thing to do is to change the model from impedance to admittance form<br />
and write the constitutive relation for the internal variable in an "implicit form"<br />
<br />
<math><br />
\left\{<br />
\begin{array}{l}<br />
\dfrac{1}{\mu} \dot{x} + Q(V(t), x(t)) = \dfrac{1}{\mu} \dot{x} - I(t) = 0\\<br />
H(x) = \left\{<br />
\begin{array}{l}<br />
R \qquad x \le 0\\<br />
R - (R - r) x \qquad 0 < x < 1\\<br />
r \qquad x > 1<br />
\end{array} <br />
\right.\\<br />
I(t) = \dfrac{V(t)}{H(x)}<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
It is then useful to compute the derivatives for the current and for the constitutive relation<br />
<br />
<math><br />
\dfrac{\partial I}{\partial x} = -\dfrac{H'(x)}{H(x)^2} <br />
</math><br />
<br />
<math><br />
\dfrac{\partial I}{\partial V} = \dfrac{1}{H} <br />
</math><br />
<br />
<math><br />
H'(x) = \left\{<br />
\begin{array}{l}<br />
0 \qquad x \le 0\\<br />
- (R - r) \qquad 0 < x < 1\\<br />
0 \qquad x > 1<br />
\end{array} <br />
\right.<br />
</math><br />
<br />
Next we define external variables (pin voltages) for the device and coupling variables (pin currents)<br />
<br />
N.B. the convention in existing device models is that pin currents are <br />
assumed to be entering the device<br />
<br />
<math><br />
\begin{array}{l}<br />
i^{+} = I(t)\\<br />
i^{-} = -I(t)\\<br />
V(t) = v^{+} - v^{-}<br />
\end{array}<br />
</math><br />
<br />
<br />
Now define the local state vector<br />
<br />
<math><br />
z = <br />
\left[<br />
\begin{array}{l}<br />
v^{+}\\<br />
v^{-}\\<br />
x<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
and the local equations<br />
<br />
<math><br />
a \dot{z} + c(z) = 0<br />
</math><br />
<br />
and finally define the local matrices for the memristor element<br />
<br />
<math><br />
a = \left[\begin{array}{c c c} 0 & 0 & 0\\ 0 & 0 & 0\\ 0 & 0 & \dfrac{1}{\mu}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
c(z) = \left[\begin{array}{c}\dfrac{V}{H}\\[2mm] -\dfrac{V}{H}\end{array}\right]<br />
</math><br />
<br />
<br />
<math><br />
b(z) = \dfrac{\partial c}{\partial z} =<br />
\left[<br />
\begin{array}{c c c}<br />
\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial V} & \dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
-\dfrac{\partial I}{\partial V} & +\dfrac{\partial I}{\partial V} & -\dfrac{\partial I}{\partial x}\\[2mm]<br />
\end{array}<br />
\right]<br />
</math><br />
<br />
The resulting model implementation is the following<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
function [a,b,c] = Mmemristors (string, parameters, parameternames,<br />
extvar, intvar, t)<br />
<br />
if isempty(intvar)<br />
intvar = 0;<br />
endif<br />
<br />
switch string <br />
case "STRUKOV"<br />
## NLC part<br />
for ii=1:length(parameternames)<br />
eval([parameternames{ii} "=" num2str(parameters(ii)) ";"]) <br />
endfor<br />
<br />
v1 = extvar(1);<br />
v2 = extvar(2);<br />
x = intvar(1);<br />
<br />
if (x <= 0)<br />
H = RH;<br />
Hp = 0; <br />
elseif (x > 0 && x < 1)<br />
H = RH - (RH - RL) * x;<br />
Hp = - (RH - RL);<br />
else<br />
H = RL;<br />
Hp = 0;<br />
endif<br />
<br />
I = (v1-v2) / H;<br />
i1 = I;<br />
i2 = -I;<br />
<br />
dIdx = - Hp / H^2;<br />
dIdV = 1 / H;<br />
<br />
a = zeros (3);<br />
a(3, 3) = 1/ MU;<br />
<br />
b = [dIdV -dIdV dIdx;<br />
-dIdV dIdV -dIdx;<br />
-dIdV dIdV -dIdx];<br />
<br />
c = [i1 i2 i2]';<br />
<br />
break;<br />
<br />
otherwise<br />
error (["unknown section:" string])<br />
endswitch<br />
<br />
endfunction<br />
</syntaxhighlight><br />
}}<br />
<br />
<br />
<br />
As an example let's run a simulation by applying a sinusoidal signal with varying <br />
frequency<br />
<br />
{{Code| memristor model implementation|<syntaxhighlight lang="octave"><br />
t = linspace (0, 1, 100);<br />
y = [(sin (2 * pi * t * 1.5)), (sin (2 * pi * t * 4))(2:end)];<br />
t = [t, (linspace (1, 2, 100))(2:end)];<br />
pwl = [t; y](:).';<br />
<br />
c1.LCR = [];<br />
c1.totextvar = 1;<br />
<br />
c1.NLC(1).("func") = "Mvoltagesources";<br />
c1.NLC(1).("section") = "pwl";<br />
c1.NLC(1).("nextvar") = 2;<br />
c1.NLC(1).("npar") = 398;<br />
c1.NLC(1).("nrows") = 1;<br />
c1.NLC(1).("nparnames") = 0;<br />
c1.NLC(1).("parnames") = {};<br />
c1.NLC(1).("pvmatrix") = pwl;<br />
c1.NLC(1).("vnmatrix") = [1 0];<br />
c1.NLC(1).("nintvar") = 1;<br />
c1.NLC(1).("osintvar") = 0;<br />
<br />
c1.NLC(2).("func") = "Mmemristors";<br />
c1.NLC(2).("section") = "STRUKOV";<br />
c1.NLC(2).("nextvar") = 2;<br />
c1.NLC(2).("npar") = 3;<br />
<br />
c1.totintvar = 2;<br />
c1.namesn = [1 2 3];<br />
<br />
c1.NLC(2).("nrows") = 1;<br />
c1.NLC(2).("nparnames") = 3;<br />
c1.NLC(2).("parnames") = {"MU", "RH", "RL"};<br />
c1.NLC(2).("pvmatrix") = [1.8e3 1e3 1];<br />
c1.NLC(2).("vnmatrix") = [1 0];<br />
<br />
c1.NLC(2).("nintvar") = 1;<br />
c1.NLC(2).("osintvar") = 1;<br />
<br />
c1.namess = {"voltage", "current", "x"};<br />
start = [0 0 0.1];<br />
<br />
%% c = prs_iff ("memristor_example");<br />
out = tst_backward_euler (c1, start.', t, 1e-2, 300, {'voltage', 'current'});<br />
<br />
plot (out(1, 1:100), out (2, 1:100), 'r',<br />
out(1, 101:end), out(2, 101:end), 'k')<br />
<br />
legend ("frequency 1 Hz", "frequency 4 Hz")<br />
<br />
</syntaxhighlight><br />
}}<br />
<br />
[[File:memristor.png|thumb| Memristor simulation result]]<br />
<br />
The results are shown in the figure to the right.</div>Cdfhttps://wiki.octave.org/wiki/index.php?title=Ocs_package&diff=6671Ocs package2015-09-22T10:41:11Z<p>Cdf: /* Problem Formulation */</p>
<hr />
<div>= OCS : Octave Circuit Simulator =<br />
__TOC__<br />
== History and Motivation ==<br />
== Problem Formulation ==<br />
<br />
The circuit description in OCS is based on (a variant of) modified nodal analysis (MNA) model for lumped-element networks.<br />
It is easy to verify that the common charge/flux-based MNA model is a special case of the model presented below. <br />
<br />
We consider a circuit with M elements and N nodes, the core of the MNA model is a set of N equations of the form<br />
<math><br />
\sum_{{m}=1}^{M} F_{mn} = 0<br />
\qquad<br />
n = 1, \, \ldots \, ,N<br />
</math><br />
<br />
where <math>F_{mn}</math> denotes the current from the node n due to element m. <br />
<br />
The equations above are the Kirchhoff current law (KCL) for each of the electrical nodes of the network.<br />
<br />
The currents can be expressed in terms of the node voltages <math>e</math> and the internal variables <math>r_m \; (m = 1\ldots M)</math><br />
<br />
<math><br />
F_{mn} =<br />
A_{mn} \dot{r}_{m} + J_{mn} \left({e}, {r}_{m} \right)<br />
\qquad<br />
\begin{array}{l}<br />
n = 1, \, \ldots \, ,N \\<br />
m = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
Notice that the variables <math>{{r}}_{m}</math> only appear in the equations defining the fluxes relative to the m-th element, for this reason they are sometimes referred to as internal variables of the m-th element.<br />
<br />
The full MNA model is finally obtained by substituting the current definitions in the KCL and complementing it with a suitable number <math>I_{m}</math> of constitutive relations for the internal variables of each element<br />
<math><br />
\sum_{{m}=1}^{M} \left[<br />
\ A_{mn} \dot{{r}}_{m} +<br />
J_{mn} \left( {e}, {r}_{m} \right)<br />
\right] = 0<br />
\qquad <br />
\qquad<br />
\begin{array}{l}<br />
{i} = 1, \, \ldots \, ,{I}_m \\<br />
{m} = 1, \, \ldots \, ,M<br />
\end{array}<br />
</math><br />
<br />
<br />
Notice that the assumption that only time derivatives of internal variables appear above and that terms involving such derivatives are linear does not impose restrictions on the applicability of the model.<br />
<br />
== Data Structure ==<br />
<br />
A circuit is represented in OCS by a struct variable with the fields listed below<br />
<br />
{{Code|CIR file format |<syntaxhighlight lang="text" style="font-size:13px"><br />
cir_struct =<br />
{<br />
LCR: struct % the fields of LCR are shown below<br />
NLC: struct % NLC has the same fields as LCR<br />
namesn: matrix % numbers of vars that are assigned a name in and.nms<br />
namess: cell % the names corresponding to the vars above<br />
totextvar: scalar % the total number of external variables<br />
totintvar: scalar % the total number of internal variables<br />
}<br />
<br />
outstruct.LCR =<br />
{<br />
1x2 struct array containing the fields: % array has one element per block<br />
<br />
func % name of the sbn file corresponding to each block<br />
section % string parameter to be passed to the sbn files<br />
nextvar % number of external variables for e