Merken

# LGSL Numerical algorithms for Lua

#### Automatisierte Medienanalyse

## Diese automatischen Videoanalysen setzt das TIB|AV-Portal ein:

**Szenenerkennung**—

**Shot Boundary Detection**segmentiert das Video anhand von Bildmerkmalen. Ein daraus erzeugtes visuelles Inhaltsverzeichnis gibt einen schnellen Überblick über den Inhalt des Videos und bietet einen zielgenauen Zugriff.

**Texterkennung**–

**Intelligent Character Recognition**erfasst, indexiert und macht geschriebene Sprache (zum Beispiel Text auf Folien) durchsuchbar.

**Spracherkennung**–

**Speech to Text**notiert die gesprochene Sprache im Video in Form eines Transkripts, das durchsuchbar ist.

**Bilderkennung**–

**Visual Concept Detection**indexiert das Bewegtbild mit fachspezifischen und fächerübergreifenden visuellen Konzepten (zum Beispiel Landschaft, Fassadendetail, technische Zeichnung, Computeranimation oder Vorlesung).

**Verschlagwortung**–

**Named Entity Recognition**beschreibt die einzelnen Videosegmente mit semantisch verknüpften Sachbegriffen. Synonyme oder Unterbegriffe von eingegebenen Suchbegriffen können dadurch automatisch mitgesucht werden, was die Treffermenge erweitert.

Erkannte Entitäten

Sprachtranskript

00:05

is OK so our high everyone and Leslie I'm I'm presenting L GSL today which is a model for numerical algorithms and so it gives you a very friendly large interface to the new Science Library and I should stress I'm not I'm just 1 of the authors it was actually started as L L as gsl shell by Francesco about ready with big contributions from Benjamin and with and

00:33

so what Algiers exactly and like I said it provides a very friendly and intuitive interface on top of that and scientific library and it's based on the models numerical models of GSL show and the weights implemented is that it uses the the FFI or foreign function interface bindings um 2 functions from the GSL library so the nice thing about this is that you do not have to compile and thing the Afify Library just allows you to link directly to the shared library of Giselle and of course we want this to be a real all at sort of alternative to writing the applications so that means that performance really matters and that as you know that it's it's really fast 1 of the fastest dynamic languages and implementations and also thanks to the fact that you can use a custom BLAS implementation of Gisela's blazingly fast so let's look under the hood um it uses Afify matter types this is a bit like a matter table but it's and applied on a kind of that and FFI times so this is that is typically a type like um a certain struck that represents a matrix and so it turns these these see types into very feature full and garbage collected which is very important as new objects so an example here is that the matrix A class which you can require it's a submodular as all GSL you can create matrices and so you can have like element-wise subtraction of a scalar so this on on accessory well you can invert them solve solve systems and it can also be pretty printed and and thanks to um while operator overloading and so on you can mix all kinds of objects like make use matresses scalars and complex in real numbers and this is all handled very gracefully and finally even though these objects are very happy to full of new objects you can still just pass them to all this just the functions so a 2nd example is that the complex number which is actually already supported in logic but the promise you can't do anything with them there are no operators the final and L. also provides these operations um but of course if you want to do some of operations you will get them you will need them from the Algiers all complex the regular mouth library will work on complex numbers to you all the operations are defined like division and here taking the power of the eye to the i which is a real number surprisingly and here is an example where the the exponents and of the complex the into the exponent function so using these basic

03:30

types you can start implementing wanted writing nice wrappers around a new scientific library but I should 1st step will for a while and explain why the new scientific libraries and interesting library to use so 1st of all it's very well written it said quite well at the time of modern object-oriented C at its answer compliancy code it's very well tested in the massive test suite and it's it's also had years of field testing which is very important if you want to read depend on on these calculations it has a very good reference manual in print actually and maybe most importantly or it might be repelled to some it's free as in freedom that means GPL licensed and so you can freely share your applications if you have a look at the website you see the following year at the interface of GSL was designed to be simple to link into very high level languages such as new guile or pipe and of course in a grave omission here on the so it's a very extensive library

04:36

and not everything is provided yet in Algiers uh so I'll just put everything it has a nice and no duration interface in bold here and the things only have their Afify bindings in red thank this slippery clear that's a published the slides 1 principle it's easy to add some more red items but that's not the idea of the library we just want to provide some bindings to Afify I mean Afify bindings to the C functions we really want to have a nice interface as well so why would you

05:10

want to use Algiers on not just write the application because the to be honest it's already I mean it's the application for GSL functors is already relatively simple and elegant so here's a C implementation of a Monte Carlo integration so you can include the necessary headers you will include some I like integration bounds you allocate everything that you need to allocate the spaces you manually checked during the convergence criteria and then add the answer don't forget to clear to free your and resources not only this becomes a bit and simpler so I could require the 2 modules yes and man matrix that you need that you define your bounds again and then you just call together intake to integrate the function and printer Results it it so um I told you that it's blazingly fast and maybe some of your already thinking what integration with the functions and and so 1 of the tricky bits about using GSL is uh that you will need callbacks to integrate the functions so-called bag that means that you're calling a C function from newer which in turn is calling the function and thanks to the node and environment as possible thanks to the magic and careful planning anything according to make and and for the problem with this is that these calls cannot be optimized so they cannot be aligned the and so if you just naively using phi bindings and called quadrature algorithms 0 ordinary differential equation integrators everything that called function thousands or even millions of times were very very very high performance penalty so the solution is actually to we implemented the algorithms and so the following um the following functions were re-implemented in so typically the ones that cold nor functions a lot like quadrature sorting the color integration differential equations and root finding but this is not yet in in which we have to do is know that if you really naively reimplement something in US and you run it it's already very fast with limited so um but you have to keep in mind the following guidelines like using locals and this is the same for online for allegedly ketchup the functions if you use a lot minimize the number of live variables that that means not putting all your your variable declarations at the top I mean it's not for clients and we use the numeric for instead of bears if you wanted to be fast avoids unbiased branches and the last point is important avoid nested loops or looks at very low titration counts and if we would really want to compete with C then it becomes very tricky to combine this last item like those that avoids method the loops or small loops uh it's hard to combine this with flexible code the so how is is fixed the um so to do that incorporate this I mean to to avoid having these and low activation patterns and the loops are enrolled in um automatically using the template pass originally written by Richard Leakey so as an example here this is that 1 of the steps in the 4th or the room Jupiter uh ordinary differential equations the integration algorithm so there's the main integration which is called the thousands or millions of times an insight that you have the small loops over the number of dimensions so the way to to solve really as having the small loops block the mean so down your your process because what they will never get hot because they're not executed frequently enough and the way to do this is to have 1st do a pass over a template templates here indicated with that the hashes in front and also with the dollar signs and rule the unrolled loop 1st and only then include the code so this only works for a very small number of dimensions if you have a very large ODE system we should use for the vector which is also still under development and final that of course is used as the fire raced instead of you tables to speed things up even more so I come

09:42

from the here but fortunately I have exported some of the year images and so it if you want to visualize your adventures without Giselle I recommend graph toolkit which is also started as a component of GSL shell the to play very nicely together so here are some examples of visualizations of the features linear fitting have Fourier transforms an ODE ease um and so on and here even more examples so and I would encourage you all to try it out

10:17

see if you will 1st need some requirements like candidates please install it it's only 2 lines of code even if you don't want to use lg as well so if you and using the rocks install because they're to install Giselle because really the distribution mechanism of choice nowadays for their modules and if you want to plots the things that I just showed you do install graph to its very needs very fast and so finally

10:48

installing GSL usually journals ships with your distribution and then is just a 1 line of lyrics and itself so documentation is available here and please visit my get page because full requests are always welcome thank you very much if he be questions in the yes the 1st point the you walls off and no sparse matrices are not supported yet that's um if there's enough demand like in printed causal and this was used it is supported by DSL yes yes and the whole or in the world is all the more you he or she factor there is the we accurately to there is no and also vectorization audits so I hope I'm not lying here that said when you mean exactly and I think it would be possible but it would be quite a bit of data I remind you what is the whole idea of all I have but of course as a user you want to be able to define a function you and this given to an integrated said that the mean and the work of the world the comparison the of 2 it's the I made some benchmarks and back up a constant now but it's like 10 20 % difference at most and actually if I use the non-optimized GSL I am and I compared to the new implementation than the implementation faster so for integration so that's that's nice now in the state of used was of a and B I I just released 0 . 1 0 years and so um I've used it myself in wild and preserve production for research so in this is a lot of this is that if I do we use these rules you know as to what as people call it not for everything I think I don't think that's also all we need so maybe sorcery to expose everything in thus anyway but at X so you can you can already use everything in 1 have to be careful what I see that the main features of class because these are in that there's like a raw year old years old book GSL module in which all the GSL exposed to functions are just you can just use them and there are some loss functions in there as well and adding loss functions just adding a senior statement these the question because of the

00:00

Autorisierung

Algorithmus

Informationsmodellierung

Näherungsverfahren

Nabel <Mathematik>

Näherungsverfahren

Programmbibliothek

Computeranimation

Gammafunktion

Schnittstelle

00:33

Matrizenrechnung

Bit

Freeware

Formale Sprache

Hochdruck

Kartesische Koordinaten

Komplex <Algebra>

Skalarfeld

Computeranimation

Regulärer Graph

Schnittstelle

Softwaretest

Lineares Funktional

Schnelltaste

Nichtlinearer Operator

Suite <Programmpaket>

Exponent

Güte der Anpassung

Ruhmasse

Rechnen

Invariante

Sinusfunktion

Restklasse

Programmbibliothek

Tabelle <Informatik>

Subtraktion

Overloading <Informatik>

Web Site

Gewicht <Mathematik>

Komplexe Darstellung

Klasse <Mathematik>

Matrizenrechnung

Implementierung

Mathematische Logik

Division

Code

Informationsmodellierung

Modul <Datentyp>

Reelle Zahl

Diskrete Simulation

Objektorientierte Programmiersprache

Datentyp

Wrapper <Programmierung>

Programmbibliothek

Äußere Algebra eines Moduls

Gammafunktion

Leistung <Physik>

Modul

Algorithmus

Matrizenring

Diskretes System

Physikalisches System

Nabel <Mathematik>

Quick-Sort

Objekt <Kategorie>

Höhere Programmiersprache

04:33

Resultante

Matrizenrechnung

Stellenring

Bit

Prozess <Physik>

Punkt

Desintegration <Mathematik>

NP-hartes Problem

Kartesische Koordinaten

Zählen

Raum-Zeit

Gebundener Zustand

Eins

Gewöhnliche Differentialgleichung

Client

Algorithmus

Vorzeichen <Mathematik>

Mustersprache

Wurzel <Mathematik>

Ordnung <Mathematik>

E-Mail

Funktor

Schnittstelle

Metropolitan area network

Caching

Schnelltaste

Lineares Funktional

Template

Stellenring

Systemaufruf

Variable

Systemaufruf

Rechenschieber

Arithmetisches Mittel

Deklarative Programmiersprache

Programmbibliothek

Programmierumgebung

Message-Passing

Tabelle <Informatik>

Hausdorff-Dimension

Matrizenrechnung

Automatische Handlungsplanung

Implementierung

Code

Loop

Variable

Knotenmenge

Hash-Algorithmus

Programmbibliothek

Näherungsverfahren

Softwareentwickler

Gammafunktion

Algorithmus

Verzweigendes Programm

Übertrag

Vektorraum

Physikalisches System

Modul

Integral

Gewöhnliche Differentialgleichung

Array <Informatik>

Loop

Differentialgleichungssystem

Kantenfärbung

09:40

Algorithmus

Kraftfahrzeugmechatroniker

Distributionstheorie

Graph

Benutzerfreundlichkeit

Plot <Graphische Darstellung>

Code

Abenteuerspiel

Gewöhnliche Differentialgleichung

Lineare Regression

Visualisierung

Zusammenhängender Graph

Visualisierung

Gerade

Bildgebendes Verfahren

Auswahlaxiom

10:47

Distributionstheorie

Subtraktion

Bit

Einfügungsdämpfung

Punkt

Klasse <Mathematik>

Implementierung

Extrempunkt

Computeranimation

Homepage

Gerade

Gammafunktion

Lineares Funktional

Algorithmus

Befehl <Informatik>

Physikalischer Effekt

Schlussregel

Paarvergleich

Schwach besetzte Matrix

Vektorraum

Biprodukt

Modul

Teilbarkeit

Integral

Arithmetisches Mittel

Rohdaten

Aggregatzustand

### Metadaten

#### Formale Metadaten

Titel | LGSL Numerical algorithms for Lua |

Untertitel | A Lua-ish interface to the GNU Scientific Library |

Serientitel | FOSDEM 2016 |

Teil | 99 |

Anzahl der Teile | 110 |

Autor | Cruz, Lesley De |

Lizenz |
CC-Namensnennung 2.0 Belgien: Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen. |

DOI | 10.5446/31013 |

Herausgeber | FOSDEM VZW |

Erscheinungsjahr | 2016 |

Sprache | Englisch |

#### Inhaltliche Metadaten

Fachgebiet | Informatik |