Download presentation
Presentation is loading. Please wait.
Published byMadison Shelton Modified over 9 years ago
1
Universal Linear Algebra API based on M4 Michael Fiero Isaac Asiamah
2
Presentation Overview APIs M4 Linear Algebra Project Purpose User Analysis Feasability Study Project Content How It Works Documentation Conclusion
3
APIs API – Application Programming Interface Collection of Functions and Data Structures “Black Box” This project is an open API
4
M4 Macro Processing Language Common Uses: –Text Replacement Tool –As a Preprocessor –Generation of Higher Level Language Code
5
M4 Macros Macros may be either built-in or user defined Some built in macros: –define, undefine – defines or undefines a macro name –pushdef, popdef – similar, but use stack –changequote, changecom – change default quotes and comments –incr, decr – increment and decrement an integer –eval – evaluates an argument as an arithmetic expression
6
Defining Macros A macro has the form: –define (name,[expansion]) Calling the macro requires only the name of the macro as it was defined. Example: define (`foo’,`Hello World!’) => foo => Hello World!
7
Invoking M4 M4 is by default included in most UNIX development environments. Terminal command line: – m4 [option…][file…] Examples of Commands: –--help, --version, --interactive
8
Files and M4 M4 can take files as input –m4 myfile.m4 Can also generate files –m4 myfile.m4 > myoutput.txt This is how this particular project generates APIs –m4 pyapi.m4 > linear.py
9
Linear Algebra The study of: –Vectors –Vector Spaces –Linear Transformations –Systems of Linear Equations Uses in Computer Science: –Graphics –Modern Math Analysis –Economics
10
Project Purpose Linear is very useful in computer science APIs tend to be language specific This API can be set up for use with: –C –C++ –Java –Perl –Python
11
User Needs A universal API that performs linear algebra operations and is based on M4 Adequate documentation for using and adding functions M4 based test suite
12
Feasibility Study Challenges: –Becoming well acquainted with: M4 Perl Python –Creating a working API with a clear and logical structure
13
Feasibility Study There are currently Linear Algebra APIs in existence. However, they are language specific The most common ones seem to be written for Java There are also some written for C, C++, and Perl
14
Included Functionality The final project includes an m4 API for all of the target languages. There is a simple setup script which will be easy to use It also includes a detailed documentation for how to use the functions. A test suite has been provided as well.
15
Some Included Functions Some of the functions included are: –Vector Normalization –Dot Product –Matrix Multiplication –Transpose of a Matrix –Square and Symmetrical Matrices –Determinant of a Matrix
16
How It Works The program contains: –M4 code for the generation of files which can be included in your program C and C++ - #include Java – import linear.*; Python – import linear Perl – require “linear.pl”; –Setup script written in bash,which calls M4 for the user to generate the necessary file
17
Using the Functions Using the functions is a matter of simply calling them based on the syntax of the language being written –C, C++, Java - function(arg1,arg2); –Python - linear.function(arg1,arg2) –Perl – function(arg1,arg2); Very simple, and familiar use
18
Adding Functions Adding functions requires knowledge of M4 and of each specific language All of the languages are similar, so adding functions is very easy This API is open, so it is free for anyone to add their own functions
19
Included Documentation The documentation includes: –User’s setup guide –Function documentation Similar to Sun’s Java Documentation –Guide to adding files –Reference Guide
20
Conclusion A good start to creating: –Universal API for C family languages Comprehensive linear algebra functions Clear documentation Ability to add functions
21
Questions This slide is here to allow for time allotted to answering possible questions.
22
References http://www.gnu.org/software/m4/ http://www.comp.leeds.ac.uk/Perl/start.html http://docs.python.org/tut/ http://www.bernstein- plussons.com/.dowling/POCSF06/Project2.htmlhttp://www.bernstein- plussons.com/.dowling/POCSF06/Project2.html http://en.wikipedia.org/
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.