Section “Creating R Packages” in Writing R Extensions

Total Page:16

File Type:pdf, Size:1020Kb

Section “Creating R Packages” in Writing R Extensions Writing R Extensions Version 3.0.0 RC (2013-03-28) R Core Team Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team. Copyright c 1999{2013 R Core Team i Table of Contents Acknowledgements ::::::::::::::::::::::::::::::::: 1 1 Creating R packages:::::::::::::::::::::::::::: 2 1.1 Package structure :::::::::::::::::::::::::::::::::::::::::::::: 3 1.1.1 The `DESCRIPTION' file :::::::::::::::::::::::::::::::::::: 4 1.1.2 Licensing:::::::::::::::::::::::::::::::::::::::::::::::::: 9 1.1.3 The `INDEX' file :::::::::::::::::::::::::::::::::::::::::: 10 1.1.4 Package subdirectories:::::::::::::::::::::::::::::::::::: 11 1.1.5 Data in packages ::::::::::::::::::::::::::::::::::::::::: 14 1.1.6 Non-R scripts in packages :::::::::::::::::::::::::::::::: 15 1.2 Configure and cleanup :::::::::::::::::::::::::::::::::::::::: 16 1.2.1 Using `Makevars'::::::::::::::::::::::::::::::::::::::::: 19 1.2.1.1 OpenMP support:::::::::::::::::::::::::::::::::::: 22 1.2.1.2 Using pthreads :::::::::::::::::::::::::::::::::::::: 23 1.2.1.3 Compiling in sub-directories ::::::::::::::::::::::::: 23 1.2.2 Configure example ::::::::::::::::::::::::::::::::::::::: 24 1.2.3 Using F95 code :::::::::::::::::::::::::::::::::::::::::: 26 1.3 Checking and building packages ::::::::::::::::::::::::::::::: 26 1.3.1 Checking packages ::::::::::::::::::::::::::::::::::::::: 27 1.3.2 Building package tarballs ::::::::::::::::::::::::::::::::: 30 1.3.3 Building binary packages ::::::::::::::::::::::::::::::::: 32 1.4 Writing package vignettes ::::::::::::::::::::::::::::::::::::: 33 1.4.1 Encodings and vignettes:::::::::::::::::::::::::::::::::: 35 1.4.2 Non-Sweave vignettes :::::::::::::::::::::::::::::::::::: 35 1.5 Submitting a package to CRAN :::::::::::::::::::::::::::::::: 36 1.6 Package namespaces::::::::::::::::::::::::::::::::::::::::::: 36 1.6.1 Specifying imports and exports ::::::::::::::::::::::::::: 37 1.6.2 Registering S3 methods :::::::::::::::::::::::::::::::::: 38 1.6.3 Load hooks :::::::::::::::::::::::::::::::::::::::::::::: 38 1.6.4 useDynLib ::::::::::::::::::::::::::::::::::::::::::::::: 39 1.6.5 An example :::::::::::::::::::::::::::::::::::::::::::::: 41 1.6.6 Namespaces with S4 classes and methods ::::::::::::::::: 42 1.7 Writing portable packages ::::::::::::::::::::::::::::::::::::: 43 1.7.1 PDF size ::::::::::::::::::::::::::::::::::::::::::::::::: 46 1.7.2 Check timing::::::::::::::::::::::::::::::::::::::::::::: 46 1.7.3 Encoding issues :::::::::::::::::::::::::::::::::::::::::: 47 1.7.4 Binary distribution ::::::::::::::::::::::::::::::::::::::: 48 1.8 Diagnostic messages::::::::::::::::::::::::::::::::::::::::::: 48 1.9 Internationalization ::::::::::::::::::::::::::::::::::::::::::: 50 1.9.1 C-level messages ::::::::::::::::::::::::::::::::::::::::: 50 1.9.2 R messages::::::::::::::::::::::::::::::::::::::::::::::: 50 1.9.3 Preparing translations :::::::::::::::::::::::::::::::::::: 51 1.10 CITATION files:::::::::::::::::::::::::::::::::::::::::::::: 51 ii 1.11 Package types:::::::::::::::::::::::::::::::::::::::::::::::: 52 1.11.1 Frontend :::::::::::::::::::::::::::::::::::::::::::::::: 52 1.12 Services:::::::::::::::::::::::::::::::::::::::::::::::::::::: 53 2 Writing R documentation files ::::::::::::::: 54 2.1 Rd format :::::::::::::::::::::::::::::::::::::::::::::::::::: 54 2.1.1 Documenting functions ::::::::::::::::::::::::::::::::::: 55 2.1.2 Documenting data sets ::::::::::::::::::::::::::::::::::: 60 2.1.3 Documenting S4 classes and methods ::::::::::::::::::::: 61 2.1.4 Documenting packages ::::::::::::::::::::::::::::::::::: 61 2.2 Sectioning :::::::::::::::::::::::::::::::::::::::::::::::::::: 62 2.3 Marking text:::::::::::::::::::::::::::::::::::::::::::::::::: 62 2.4 Lists and tables ::::::::::::::::::::::::::::::::::::::::::::::: 64 2.5 Cross-references ::::::::::::::::::::::::::::::::::::::::::::::: 65 2.6 Mathematics :::::::::::::::::::::::::::::::::::::::::::::::::: 66 2.7 Figures ::::::::::::::::::::::::::::::::::::::::::::::::::::::: 66 2.8 Insertions ::::::::::::::::::::::::::::::::::::::::::::::::::::: 67 2.9 Indices :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 68 2.10 Platform-specific documentation ::::::::::::::::::::::::::::: 68 2.11 Conditional text ::::::::::::::::::::::::::::::::::::::::::::: 68 2.12 Dynamic pages :::::::::::::::::::::::::::::::::::::::::::::: 69 2.13 User-defined macros:::::::::::::::::::::::::::::::::::::::::: 70 2.14 Encoding :::::::::::::::::::::::::::::::::::::::::::::::::::: 71 2.15 Processing documentation files ::::::::::::::::::::::::::::::: 71 2.16 Editing Rd files :::::::::::::::::::::::::::::::::::::::::::::: 72 3 Tidying and profiling R code ::::::::::::::::: 73 3.1 Tidying R code ::::::::::::::::::::::::::::::::::::::::::::::: 73 3.2 Profiling R code for speed ::::::::::::::::::::::::::::::::::::: 73 3.3 Profiling R code for memory use::::::::::::::::::::::::::::::: 75 3.3.1 Memory statistics from Rprof :::::::::::::::::::::::::::: 76 3.3.2 Tracking memory allocations ::::::::::::::::::::::::::::: 76 3.3.3 Tracing copies of an object ::::::::::::::::::::::::::::::: 76 3.4 Profiling compiled code ::::::::::::::::::::::::::::::::::::::: 77 3.4.1 Linux :::::::::::::::::::::::::::::::::::::::::::::::::::: 77 3.4.1.1 sprof :::::::::::::::::::::::::::::::::::::::::::::::: 77 3.4.1.2 oprofile:::::::::::::::::::::::::::::::::::::::::::::: 78 3.4.2 Solaris ::::::::::::::::::::::::::::::::::::::::::::::::::: 79 3.4.3 OS X :::::::::::::::::::::::::::::::::::::::::::::::::::: 79 iii 4 Debugging ::::::::::::::::::::::::::::::::::::: 80 4.1 Browsing ::::::::::::::::::::::::::::::::::::::::::::::::::::: 80 4.2 Debugging R code :::::::::::::::::::::::::::::::::::::::::::: 81 4.3 Using gctorture and valgrind :::::::::::::::::::::::::::::::::: 85 4.3.1 Using gctorture :::::::::::::::::::::::::::::::::::::::::: 85 4.3.2 Using valgrind ::::::::::::::::::::::::::::::::::::::::::: 86 4.4 Debugging compiled code ::::::::::::::::::::::::::::::::::::: 88 4.4.1 Finding entry points in dynamically loaded code :::::::::: 89 4.4.2 Inspecting R objects when debugging ::::::::::::::::::::: 89 5 System and foreign language interfaces:::::: 92 5.1 Operating system access :::::::::::::::::::::::::::::::::::::: 92 5.2 Interface functions .C and .Fortran::::::::::::::::::::::::::: 92 5.3 dyn.load and dyn.unload :::::::::::::::::::::::::::::::::::: 94 5.4 Registering native routines :::::::::::::::::::::::::::::::::::: 96 5.4.1 Speed considerations ::::::::::::::::::::::::::::::::::::: 98 5.4.2 Linking to native routines in other packages :::::::::::::: 99 5.5 Creating shared objects :::::::::::::::::::::::::::::::::::::: 100 5.6 Interfacing C++ code :::::::::::::::::::::::::::::::::::::::: 101 5.7 Fortran I/O:::::::::::::::::::::::::::::::::::::::::::::::::: 103 5.8 Linking to other packages :::::::::::::::::::::::::::::::::::: 103 5.8.1 Unix-alikes:::::::::::::::::::::::::::::::::::::::::::::: 103 5.8.2 Windows:::::::::::::::::::::::::::::::::::::::::::::::: 104 5.9 Handling R objects in C ::::::::::::::::::::::::::::::::::::: 105 5.9.1 Handling the effects of garbage collection :::::::::::::::: 106 5.9.2 Allocating storage::::::::::::::::::::::::::::::::::::::: 108 5.9.3 Details of R types ::::::::::::::::::::::::::::::::::::::: 108 5.9.4 Attributes :::::::::::::::::::::::::::::::::::::::::::::: 110 5.9.5 Classes:::::::::::::::::::::::::::::::::::::::::::::::::: 112 5.9.6 Handling lists ::::::::::::::::::::::::::::::::::::::::::: 112 5.9.7 Handling character data::::::::::::::::::::::::::::::::: 113 5.9.8 Finding and setting variables :::::::::::::::::::::::::::: 113 5.9.9 Some convenience functions ::::::::::::::::::::::::::::: 114 5.9.9.1 Semi-internal convenience functions::::::::::::::::: 114 5.9.10 Named objects and copying :::::::::::::::::::::::::::: 115 5.10 Interface functions .Call and .External:::::::::::::::::::: 116 5.10.1 Calling .Call :::::::::::::::::::::::::::::::::::::::::: 116 5.10.2 Calling .External ::::::::::::::::::::::::::::::::::::: 117 5.10.3 Missing and special values:::::::::::::::::::::::::::::: 119 5.11 Evaluating R expressions from C :::::::::::::::::::::::::::: 119 5.11.1 Zero-finding:::::::::::::::::::::::::::::::::::::::::::: 121 5.11.2 Calculating numerical derivatives::::::::::::::::::::::: 122 5.12 Parsing R code from C:::::::::::::::::::::::::::::::::::::: 125 5.12.1 Accessing source references ::::::::::::::::::::::::::::: 126 5.13 External pointers and weak references ::::::::::::::::::::::: 127 5.13.1 An example :::::::::::::::::::::::::::::::::::::::::::: 128 5.14 Vector accessor functions:::::::::::::::::::::::::::::::::::: 129 5.15 Character encoding issues ::::::::::::::::::::::::::::::::::: 129 iv 6 The R API: entry points for C code :::::::: 131 6.1 Memory allocation ::::::::::::::::::::::::::::::::::::::::::: 131 6.1.1 Transient storage allocation ::::::::::::::::::::::::::::: 132 6.1.2 User-controlled memory ::::::::::::::::::::::::::::::::: 132 6.2 Error
Recommended publications
  • Fortran Resources 1
    Fortran Resources 1 Ian D Chivers Jane Sleightholme May 7, 2021 1The original basis for this document was Mike Metcalf’s Fortran Information File. The next input came from people on comp-fortran-90. Details of how to subscribe or browse this list can be found in this document. If you have any corrections, additions, suggestions etc to make please contact us and we will endeavor to include your comments in later versions. Thanks to all the people who have contributed. Revision history The most recent version can be found at https://www.fortranplus.co.uk/fortran-information/ and the files section of the comp-fortran-90 list. https://www.jiscmail.ac.uk/cgi-bin/webadmin?A0=comp-fortran-90 • May 2021. Major update to the Intel entry. Also changes to the editors and IDE section, the graphics section, and the parallel programming section. • October 2020. Added an entry for Nvidia to the compiler section. Nvidia has integrated the PGI compiler suite into their NVIDIA HPC SDK product. Nvidia are also contributing to the LLVM Flang project. Updated the ’Additional Compiler Information’ entry in the compiler section. The Polyhedron benchmarks discuss automatic parallelisation. The fortranplus entry covers the diagnostic capability of the Cray, gfortran, Intel, Nag, Oracle and Nvidia compilers. Updated one entry and removed three others from the software tools section. Added ’Fortran Discourse’ to the e-lists section. We have also made changes to the Latex style sheet. • September 2020. Added a computer arithmetic and IEEE formats section. • June 2020. Updated the compiler entry with details of standard conformance.
    [Show full text]
  • Cambridge University Press 978-1-108-78987-5 — How to Write Good Programs Perdita Stevens Index More Information
    Cambridge University Press 978-1-108-78987-5 — How to Write Good Programs Perdita Stevens Index More Information Index A bold page number indicates where a term is deined. abstract syntax tree, 105 C, 35, 45, 189 abstraction, 29, 141 C♯,35 see also model C++, 35, 190 agile, 64, 159, 198 camel case, 89 algorithm, 29, 147, 148, 196 change, 141, 144, 197 Alice, 44 checklist, 127 arguments, 25,28 cloud, 66 functions as, 45 code order of, 108 commented-out, 62 type of, 41, 108 completion, 52,90 assert, 71 dead, 64 assignment, 131 line length, 99 vs. comparison, 126 reputable body of, 46, 63, 94, 99 Atom, 18 spaghetti, 98, 122 autocompletion, 52,90 unreachable, 64 autosave, 57 code sense, 3, 133 coding, 4 backups, 65 coding dojo, 153 bar, see metasyntactic variable coding interview, 148 BASIC, 44, 125 command line, 15, 49 baz, see metasyntactic variable comment, 27, 70, 85–88 BlueJ, 44, 54 commenting-out, 62 breakpoint, 111 comparison bug, 32, 101, 190, 191 of booleans, 126 after removing, 124 of objects, 130 avoiding, 138 vs. assignment, 126 avoiding recurrence of, 77 compiler, 13, 35 in compiler, 109 bug, 109 removing, 122 incremental, 51 the Lauren bug, 78 computational complexity, 148 see also debugging content assist, 52,90 build, 51, 53 contract, 88 202 © in this web service Cambridge University Press www.cambridge.org Cambridge University Press 978-1-108-78987-5 — How to Write Good Programs Perdita Stevens Index More Information Index 203 crash, 118 time, 146 currying, 23 user, 146 Emacs, 18, 49, 58, 90, 95 data science, 192 embedded
    [Show full text]
  • Section “Creating R Packages” in Writing R Extensions
    Writing R Extensions Version 3.1.0 Under development (2013-03-29) R Core Team Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team. Copyright c 1999{2013 R Core Team i Table of Contents Acknowledgements ::::::::::::::::::::::::::::::::: 1 1 Creating R packages:::::::::::::::::::::::::::: 2 1.1 Package structure :::::::::::::::::::::::::::::::::::::::::::::: 3 1.1.1 The `DESCRIPTION' file :::::::::::::::::::::::::::::::::::: 4 1.1.2 Licensing:::::::::::::::::::::::::::::::::::::::::::::::::: 9 1.1.3 The `INDEX' file :::::::::::::::::::::::::::::::::::::::::: 10 1.1.4 Package subdirectories:::::::::::::::::::::::::::::::::::: 11 1.1.5 Data in packages ::::::::::::::::::::::::::::::::::::::::: 14 1.1.6 Non-R scripts in packages :::::::::::::::::::::::::::::::: 15 1.2 Configure and cleanup :::::::::::::::::::::::::::::::::::::::: 16 1.2.1 Using `Makevars'::::::::::::::::::::::::::::::::::::::::: 19 1.2.1.1 OpenMP support::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Evolving Software Repositories
    1 Evolving Software Rep ositories http://www.netli b.org/utk/pro ject s/esr/ Jack Dongarra UniversityofTennessee and Oak Ridge National Lab oratory Ron Boisvert National Institute of Standards and Technology Eric Grosse AT&T Bell Lab oratories 2 Pro ject Fo cus Areas NHSE Overview Resource Cataloging and Distribution System RCDS Safe execution environments for mobile co de Application-l evel and content-oriented to ols Rep ository interop erabili ty Distributed, semantic-based searching 3 NHSE National HPCC Software Exchange NASA plus other agencies funded CRPC pro ject Center for ResearchonParallel Computation CRPC { Argonne National Lab oratory { California Institute of Technology { Rice University { Syracuse University { UniversityofTennessee Uniform interface to distributed HPCC software rep ositories Facilitation of cross-agency and interdisciplinary software reuse Material from ASTA, HPCS, and I ITA comp onents of the HPCC program http://www.netlib.org/nhse/ 4 Goals: Capture, preserve and makeavailable all software and software- related artifacts pro duced by the federal HPCC program. Soft- ware related artifacts include algorithms, sp eci cations, designs, do cumentation, rep ort, ... Promote formation, growth, and interop eration of discipline-oriented rep ositories that organize, evaluate, and add value to individual contributions. Employ and develop where necessary state-of-the-art technologies for assisting users in nding, understanding, and using HPCC software and technologies. 5 Bene ts: 1. Faster development of high-quality software so that scientists can sp end less time writing and debugging programs and more time on research problems. 2. Less duplication of software development e ort by sharing of soft- ware mo dules.
    [Show full text]
  • Scipy 1.0: Fundamental Algorithms for Scientific Computing in Python
    PERSPECTIVE https://doi.org/10.1038/s41592-019-0686-2 SciPy 1.0: fundamental algorithms for scientific computing in Python Pauli Virtanen1, Ralf Gommers 2*, Travis E. Oliphant2,3,4,5,6, Matt Haberland 7,8, Tyler Reddy 9, David Cournapeau10, Evgeni Burovski11, Pearu Peterson12,13, Warren Weckesser14, Jonathan Bright15, Stéfan J. van der Walt 14, Matthew Brett16, Joshua Wilson17, K. Jarrod Millman 14,18, Nikolay Mayorov19, Andrew R. J. Nelson 20, Eric Jones5, Robert Kern5, Eric Larson21, C J Carey22, İlhan Polat23, Yu Feng24, Eric W. Moore25, Jake VanderPlas26, Denis Laxalde 27, Josef Perktold28, Robert Cimrman29, Ian Henriksen6,30,31, E. A. Quintero32, Charles R. Harris33,34, Anne M. Archibald35, Antônio H. Ribeiro 36, Fabian Pedregosa37, Paul van Mulbregt 38 and SciPy 1.0 Contributors39 SciPy is an open-source scientific computing library for the Python programming language. Since its initial release in 2001, SciPy has become a de facto standard for leveraging scientific algorithms in Python, with over 600 unique code contributors, thou- sands of dependent packages, over 100,000 dependent repositories and millions of downloads per year. In this work, we provide an overview of the capabilities and development practices of SciPy 1.0 and highlight some recent technical developments. ciPy is a library of numerical routines for the Python program- has become the standard others follow and has seen extensive adop- ming language that provides fundamental building blocks tion in research and industry. Sfor modeling and solving scientific problems. SciPy includes SciPy’s arrival at this point is surprising and somewhat anoma- algorithms for optimization, integration, interpolation, eigenvalue lous.
    [Show full text]
  • Writing R Extensions
    Writing R Extensions Version 4.1.1 Patched (2021-09-22) R Core Team This manual is for R, version 4.1.1 Patched (2021-09-22). Copyright c 1999{2021 R Core Team Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into an- other language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the R Core Team. i Table of Contents Acknowledgements ::::::::::::::::::::::::::::::::::::::::::::::::: 1 1 Creating R packages ::::::::::::::::::::::::::::::::::::::::::: 2 1.1 Package structure :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 3 1.1.1 The DESCRIPTION file ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 1.1.2 Licensing ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 8 1.1.3 Package Dependencies::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 9 1.1.3.1 Suggested packages:::::::::::::::::::::::::::::::::::::::::::::::::::::: 12 1.1.4 The INDEX file ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 13 1.1.5 Package subdirectories :::::::::::::::::::::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Year of the Horse. the Months of The
    here are many animals named in the Template of the Hidden Texts which appear anomalous to the context. It turns out they are Chinese years or Celtic symbols (such as salmon) or constellations. Also there are several codes which the word HORSE indicates. The months of the horse,which happen to be the same horses as those of the "apocalypse" (the "unveiling"), the constellations: of the winged horse Scheat of Pegasus, the colt Equulus the foal, the horse's blaze Kurnah in Cepheus, Hippocampus the seahorse, Leucippe the white horse, Alpha Andromeda and then there is the Year of the Horse. The months of the horse have far too many ciphers ~ nag, Dan, ornament, Ma, ears, Be, Elm, shoe, Ara, Bau and all the other words which mean Gemini, Cancer, Virgo, Libra/October, Scorpio and Sagittarius. Something big is slotted for Sagittarius. The White Horse Warning at Uffington is Sagittarius, complete with the large cross of the bow and arrow. Sagittarius is not shown at all on the zodiac column of St John The Divine. This forum is a collection of all the lines with the word horse or fourteen coded within them. Before we get started on the year which is the beginning of the end for our current lifestyle, a pertinent detail will be outlined. The matter of the "shar" of the Nibiru system. The shar is the "year", the orbit this solar system keeps. Many people have many different numbers of our years in one shart. It seems the Anakim (the biblical spelling for a civilization who have as many names as there are tribes on Earth) do have some control over their system.
    [Show full text]
  • A. an Introduction to Scientific Computing with Python
    August 30, 2013 Time: 06:43pm appendixa.tex A. An Introduction to Scientific Computing with Python “The world’s a book, writ by the eternal art – Of the great author printed in man’s heart, ’Tis falsely printed, though divinely penned, And all the errata will appear at the end.” (Francis Quarles) n this appendix we aim to give a brief introduction to the Python language1 and Iits use in scientific computing. It is intended for users who are familiar with programming in another language such as IDL, MATLAB, C, C++, or Java. It is beyond the scope of this book to give a complete treatment of the Python language or the many tools available in the modules listed below. The number of tools available is large, and growing every day. For this reason, no single resource can be complete, and even experienced scientific Python programmers regularly reference documentation when using familiar tools or seeking new ones. For that reason, this appendix will emphasize the best ways to access documentation both on the web and within the code itself. We will begin with a brief history of Python and efforts to enable scientific computing in the language, before summarizing its main features. Next we will discuss some of the packages which enable efficient scientific computation: NumPy, SciPy, Matplotlib, and IPython. Finally, we will provide some tips on writing efficient Python code. Some recommended resources are listed in §A.10. A.1. A brief history of Python Python is an open-source, interactive, object-oriented programming language, cre- ated by Guido Van Rossum in the late 1980s.
    [Show full text]
  • GNU Octave a High-Level Interactive Language for Numerical Computations Edition 3 for Octave Version 3.0.1 July 2007
    GNU Octave A high-level interactive language for numerical computations Edition 3 for Octave version 3.0.1 July 2007 John W. Eaton David Bateman Søren Hauberg Copyright c 1996, 1997, 1999, 2000, 2001, 2002, 2005, 2006, 2007 John W. Eaton. This is the third edition of the Octave documentation, and is consistent with version 3.0.1 of Octave. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the con- ditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the same conditions as for modified versions. Portions of this document have been adapted from the gawk, readline, gcc, and C library manuals, published by the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301{1307, USA. i Table of Contents Preface :::::::::::::::::::::::::::::::::::::::::::::: 1 Acknowledgements :::::::::::::::::::::::::::::::::::::::::::::::::: 1 How You Can Contribute to Octave ::::::::::::::::::::::::::::::::: 4 Distribution ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 4 1 A Brief Introduction to Octave :::::::::::::::: 5 1.1 Running Octave:::::::::::::::::::::::::::::::::::::::::::::::: 5 1.2 Simple Examples :::::::::::::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Fortran Optimizing Compiler 6
    Numerical Libraries for General Interest Seminars 2015 Scientific Computing April 1, 2015 Ge Baolai SHARCNET Faculty of Science Western University Topics . Numerical libraries for scientific computing . Numerical libraries at SHARCNET . Examples – Linear algebra – FFTW – ODE solvers – Optimization – GSL – Multiprecision with MPFUN – PETSc (PDE solvers) . Q&A Overview Numerical Libraries SEMINARS 2015 Numerical Computing . Linear algebra . Nonlinear equations . Optimization . Interpolation/Approximation . Integration and differentiation . Solving ODEs . Solving PDEs . FFT . Random numbers and stochastic simulations . Special functions Copyright © 2001-2015 Western University Seminar Series on Scientific and High Performance Computing, London, Ontario, 2015 Numerical Libraries SEMINARS 2015 More fundamental problems: . Linear algebra . Nonlinear equations . Numerical integration . ODE . FFT . Random numbers . Special functions Copyright © 2001-2015 Western University Seminar Series on Scientific and High Performance Computing, London, Ontario, 2015 Numerical Libraries SEMINARS 2015 Top Ten Algorithms for Science (Jack Dongarra 2000) 1. Metropolis Algorithm for Monte Carlo 2. Simplex Method for Linear Programming 3. Krylov Subspace Iteration Methods 4. The Decompositional Approach to Matrix Computations 5. The Fortran Optimizing Compiler 6. QR Algorithm for Computing Eigenvalues 7. Quicksort Algorithm for Sorting 8. Fast Fourier Transform 9. Integer Relation Detection 10. Fast Multipole Method Copyright © 2001-2015 Western University Seminar
    [Show full text]
  • A Glossary for IWGS (Auto-Generated)
    A Glossary for IWGS (Auto-Generated) Michael Kohlhase Computer Science, FAU Erlangen-Nürnberg https://kwarc.info/kohlhase July 1, 2021 Preface This document contains an English glossary for the course Informatische Werkzeuge in den Geistes- und Sozialwissenschaften at FAU Erlangen-Nürnberg (IWGS). It is automatically generated from the sources of the IWGS course notes and should be up-to-date with the course progress. The glossary contains definitions for all technical terms used in the course, both theones defined in the course, as well as the ones presupposed. The latter should be relatively few,since IWGS is intended as a beginner’s course. 1 1 Glossary for IWGS Given a description logic D, a D-ontology consists of D-ontology–a terminology (or TBox): concepts and roles and a set of concept axioms that describe them, and – assertions (or ABox): a set of individuals and statements about concept membership and role relationships for them. To make the role of arguments extremely clear, we write functions in λ-notation. For f = f(x; E) j x 2 Xg, where E is an expression, we write λx 2 X:E. n n-dim Cartesianλ-notation space n-dim Cartesian space: A := fha1; : : : ; ani j 1≤i≤n ) ai 2 Ag, call ha1; : : : ; ani a vector n-dimensional Cartesian space An n-dimensional Cartesian product A1 × ::: × An is called a n-dimensional Cartesian space n n over A (and denoted A ) iff Ai = A for some set A for all i. We call ha1; : : : ; ani 2 A a vector. n-fold Cartesian product Let A := fAi j 1≤i≤ng be a collection of sets, then the n-fold Cartesian product A1 × ::: × An is fha1; : : : ; ani j ai 2 Ai for all 1≤i≤ng, we call ha1; : : : ; ani 2 A1 × ::: × An an n-tuple.
    [Show full text]
  • Numerical and Scientific Computing in Python
    Numerical and Scientific Computing in Python v0.1 Spring 2019 Research Computing Services IS & T Running Python for the Tutorial . If you have an SCC account, log on and use Python there. Run: module load python/3.6.2 spyder & unzip /projectnb/scv/python/NumSciPythonCode_v0.1.zip . Note that the spyder program takes a while to load! Links on the Rm 107 Terminals . On the Desktop open the folder: Tutorial Files RCS_Tutorials Tutorial Files . Copy the whole Numerical and Scientific Computing in Python folder to the desktop or to a flash drive. When you log out the desktop copy will be deleted! Run Spyder . Click on the Start Menu in the bottom left corner and type: spyder . After a second or two it will be found. Click to run it. Be patient…it takes a while to start. Outline . Python lists . The numpy library . Speeding up numpy: numba and numexpr . Libraries: scipy and opencv . Alternatives to Python Python’s strengths . Python is a general purpose language. Unlike R or Matlab which started out as specialized languages . Python lends itself to implementing complex or specialized algorithms for solving computational problems. It is a highly productive language to work with that’s been applied to hundreds of subject areas. Extending its Capabilities . However…for number crunching some aspects of the language are not optimal: . Runtime type checks . No compiler to analyze a whole program for optimizations . General purpose built-in data structures are not optimal for numeric calculations . “regular” Python code is not competitive with compiled languages (C, C++, Fortran) for numeric computing.
    [Show full text]