Octave tutorial
40 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
40 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Non-traditional High-Level Languages for HPC Applications: GNU OctaveJuan Carlos Chaves, Ph.D. SIP On-site at ARL MSRCOhio Supercomputer CenterUsers Group Conference (UGC2006)26 Jun 2006Distribution Statement A: Cleared for Public Release. Distribution is unlimited.1Purpose of This Tutorial• Provide an introduction to the Octave system• Teach how to obtain and configure Octave for your own PC• Teach how to configure, build and install Octave at the HPCMP HPC platforms• Teach how to exploit Octave HPC technology at the HPCMP Centers • Be a concise guide to relevant Octave info on the WebDistribution Statement A: Cleared for Public Release. Distribution is unlimited.2What is Octave?• High-level language, primarily intended for numerical computations initiated and maintained by John W. Eaton (University of Wisconsin)• A stated goal of Octave is to be compatible with MATLAB• Provides a convenient command line interactive interface for solving scientific and technical problems numerically• Has built-in a large collection of mathematical algorithms and convenience functionsDistribution Statement A: Cleared for Public Release. Distribution is unlimited.3Typical uses of Octave• Prototyping: an interactive Octave session becomes a system-prototyping environment rivaling systems such as the well-known MATLAB• Programming language: a powerful but easy to use programming language, mostly compatible with MATLAB, for use in developing ...

Informations

Publié par
Nombre de lectures 171
Langue English

Extrait

Non-traditional High-Level Languages for HPC Applications:
GNU Octave
Juan Carlos Chaves, Ph.D. SIP On-site at ARL MSRC Ohio Supercomputer Center
Users Group Conference (UGC2006) 26 Jun 2006
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
1
Purpose of This Tutorial
• Provide an introduction to the Octave system
• Teach how to obtain and configure Octave for your own PC
• Teach how to configure, build and install Octave at the HPCMP HPC platforms
• Teach how to exploit Octave HPC technology at the HPCMP Centers
• Be a concise guide to relevant Octave info on the Web
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
2
What is Octave?
High-level language, primarily intended for numerical computations initiated and maintained byJohn W. Eaton(University of Wisconsin)
A stated goal of Octave isto be compatible with MATLAB
Provides aconvenient command line interactive interfacefor solving scientific and technical problems numerically
Has built-ina large collection of mathematical algorithms and convenience functions
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
3
Typical uses of Octave
Prototyping:an interactive Octave session becomes a system-prototyping environment rivaling systems such as the well-known MATLAB
Programming language:a powerful but easy to use programming language, mostly compatible with MATLAB, for use in developing sophisticated programs and algorithms
Batch-oriented HPC applications:Octave and its parallel extensions may also be run under a batch system such as LSF, the mandate queuing system at the DoD HPCMP Centers
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
4
Octave Advantages
Free programavailable under the GNU General Public License (GNU GPL) and runs on Windows, Linux and Mac OS Xincluding architectures unsupported by MATLAB
MATLAB clone:syntax is very similar to MATLAB. Careful programming will allow a script to run on both Octave and MATLAB
Open source community: large and very active support communityall over the world
High productivity system:interactive - code development proceeds incrementally. Excellent development and rapid prototyping environment
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
5
Octave Disadvantages
Relativelyomcns iexplioatlltadecorp neru(But fortunately, you re taking this tutorial!)
Unlike MATLAB, it does not support object-oriented programming
Unlike MATLAB supportsonly basic graphic capabilities, limiting the application of Octave in scientific and engineering graphics, including the creation of GUIs.
Unlike MATLAB, lacks support from a multi-million dollar companysuch as the MathWorks, Inc.
Unlike MATLAB,fewer toolboxes are available
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
6
Octave – basic features
No declarations needed: octave:1> 14 + 28 ans = 42
Mixed types: octave:2> product = 16*16.34 product = 261.44
Semicolons suppress output: octave:5> product = 16*16.99; octave:6> product product 271.84 =
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
7
Octave – Matrix notation
Working with matrices: octave:7> a = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ] a = 1 1 2 3 5 8 13 21 34
Row vectors and the colon operator : _ octave:8> row vector = 1:5 row vector = _
1 2 3 4 5
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
8
Octave – Matrix Subscripting
Working with subscripts: octave:13> b = rand (3, 3); octave:14> b(3,1), b(3,2), b(3,3) ans = 0.27638 ans = 0.94927 ans = 0.36208
octave:15> b(3,2) = 1;  octave:16> b b = 0.46079 0.31457 0.53600 0.55636 0.22555 0.11940 0.276381.000000.36208
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
9
Octave – Multidimensional Arrays • Example of a 3D random array filled with normal data: octave:20> r = randn(2,3,4) r = ans(:,:,1) = -1.05765 -0.16023 0.72208 0.48319 0.84360 0.20065
ans(:,:,2) = -0.31952 -0.79753 1.01204 0.53750 -0.94572 -0.64897
ans(:,:,3) = -1.62063 1.80322 0.59228 0.42084 1.21434 2.09797
ans(:,:,4) = -1.724684 0.537532 -1.094533 0.786163 -0.568425 -0.043409
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
10
Octave – Matrix Operations • Example of a Hilbert matrix and its inverse: octave:29>H hilb(4) = H= 1.00000 0.50000 0.33333 0.25000 0.50000 0.33333 0.25000 0.20000 0.33333 0.25000 0.20000 0.16667 0.25000 0.20000 0.16667 0.14286
octave:30>H_inv = inv(H) H inv =  _ 16.000 -120.000 240.000 -140.000 -120.000 1200.000 -2700.000 1680.000 240.000 -2700.000 6480.000 -4200.000 -140.000 1680.000 -4200.000 2800.000
_ octave:31>H*H inv ans = 1.0000e+00 5.6843e-14 2.2737e-13 1.1369e-13 -1.6209e-14 1.0000e+00 -1.6032e-13 1.4477e-13 1.3137e-14 3.4139e-15 1.0000e+00 3.0947e-14 9.7387e-15 1.9165e-14 -1.1285e-13 1.0000e+00
Distribution Statement A: Cleared for Public Release. Distribution is unlimited.
11
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents