Mupad Dynamic Modules

Mupad Dynamic Modules

MuPAD Manuals M u P A D Multi Processing Algebra Data Tool Andreas Sorgatz Dynamic Modules User’s Manual and Programming Guide for MuPAD 1.4 i Dynamic Modules User’s Manual and Programming Guide for MuPAD 1.4 ii About MuPAD MuPAD is an open general purpose computer algebra system which is developed at the University of Paderborn (Germany). MuPAD versions for Windows 95/NT, Apple Macintosh System 7.x and various UNIX operating systems are available at the MuPAD ftp home site and many official MuPAD mirror sites of the Internet. Refer to ftp://ftp.mupad.de/MuPAD/. Current information about the development of MuPAD and the activities of the MuPAD research group are available via the World- Wide-Web at http://www.mupad.de. A detailed description of the MuPAD system and its high-level programming language is given in the MuPAD User’s Manual [49]1 MuPAD c is a copyright of SciFace Software GmbH & Co. KG Since Oct. 1997 MuPAD is developed in cooperation with SciFace. SciFace is responsible for the distribution of MuPAD and provides commercial user support. Refer to http://www.sciface.com. 1Also refer to http://www.teubner.de and http://www.wiley.co.uk iii Dynamic Modules User’s Manual and Programming Guide for MuPAD 1.4 By Andreas Sorgatz Universit¨at-GH Paderborn, Germany iv Andreas Sorgatz Dynamic Modules User’s Manual and Programming Guide for MuPAD 1.4 Macintosh is a trademark of Apple Computer, Inc.; Windows is a trademark of Microsoft Corporation; UNIX is a trademark of AT&T; X-Window is a trade- mark of MIT; MuPAD c by Sciface Software; PARI c by C. Batut, D. Bernardi, H. Cohen and M. Olivier; The author accepts no responsibility for this manual or the programs described in it. The author of this manual and the developers of MuPAD and contributions available on the accompanying CD-ROM assume no responsibility for direct or indirect damages, for losses, costs, claims for loss of profits or charges and expenses of any kind. The Author: Andreas Sorgatz, born in 1966; masters degree in Computer Science at the University of Paderborn, Germany; since 1995 member of the MuPAD research group at the Department of Mathematics and Computer Science of the Univer- sity of Paderborn. He is working on the design and implementation of computer algebra systems emphasizing the aspect software integration. The material of this book is in part taken from the author’s forthcoming Ph.D. thesis Software Integration in Interactive General Purpose Computer Algebra Systems. Preface Today, integration of software packages into computer algebra systems (CAS) and communication between CAS and other software systems using interprocess communication (IPC) protocols is gaining more and more relevancy for CAS users. For instance, one has written very efficient special purpose algorithms in a low-level language such as C/C++ and wishes to use them during a CAS session. Or software packages from the Internet should be integrated into a favourite CAS. At present, the general concept for integrating software packages into a CAS is to use IPC protocols. On Unix systems, protocols like these are usually imple- mented using sockets or can be emulated by communicating via pipes or files. They are very useful for communication between software systems running on different hosts of a computer network and also between one or more processes located on one host when no source code of the software packages is available. However, they are somewhat awkward and require a lot of communication over- head. When using such protocols the following actions have to be carried out to pass information, e.g. arguments of functions or return values, between pro- cesses or to call an external function of a communication partner (if function calls are supported by the protocol): 1. CAS data are converted into data packages (information encoding) and 2. transferred (copied physically) between the processes. 3. Data packages are reconverted into CAS data or any other representation used by the communication partner (information decoding). Information encoding and decoding may be costly. Furthermore, since data are copied the amount of memory space that is needed to store the data is doubled. Especially in Computer Algebra, where symbolic computations often require a lot of memory (intermediate data swell), this might cause problems. This method is also not very useful when large amounts of data must be passed often during the execution of an algorithm and when the execution time of vi Preface external functions is small compared to communication time. It also does not allow the linked software package to efficiently call internal functions of the CAS - on a C/C++ language level. A more flexible and efficient way to integrate C/C++ functions as well as com- plete software packages into a CAS is the author’s concept of dynamic modules. From the user’s point of view a dynamic module is similar to a CAS library package. It contains so-called module functions which are, in contrast to library functions, not written in the CAS programming language but are machine code functions like the built-in functions of the CAS kernel. From a technical point of view a dynamic module is a special kind of a machine code library (mostly implemented as a shared library) which can be linked to a CAS at run-time. After the module is loaded, its module functions are made public to the interpreter of the CAS and propagated to the user like usual CAS functions. Using the concept of dynamic linking, the machine code of the mod- ule resides within the process environment of the CAS kernel and can directly access the internal methods and data structures of the kernel. Data exchange can be achieved by simply passing data references, e.g. C/C++ pointers. This is the fastest method possible, because no data needs to be physically copied and no other communication overhead is needed. Furthermore, time and memory usage is independent of the size of data to be exchanged. Loading as well as unloading dynamic modules can both be done at any time during a CAS session. Unloading a module means to unlink its machine code from the CAS kernel and to remove it from the memory to save system resources. Its module functions, however, are still memorized by the CAS interpreter. If they are needed later, the corresponding code is automatically reloaded. This feature allows the implementation of displacement and replacement strategies for dynamic modules, which are transparent to the user. The concept of dynamic modules is easy to use and increases the flexibility of a CAS with respect to the following aspects: • An open system: The CAS kernel is extendable by the user on a C/C++ language level with nearly any desired feature. • A universal shell to integrate, utilize and test various software packages in order to use them in combination to solve mathematical problems. • A modular and freely configurable CAS: special purpose functions like effi- cient numerical algorithms or IPC protocols can be developed, maintained and distributed as optional packages independently from the CAS kernel. The variety of different packages and algorithms which can be utilized simulta- neously increases drastically. In this sense dynamic modules apply the principle of software integration to the broad field of mathematical applications. Preface vii University of Paderborn (Germany), July 1998 Andreas Sorgatz Email: [email protected] viii Preface Contents 1 Introduction and Quick Start 1 1.1 How to Read this Manual . 1 1.1.1 Remarks on the Paperback Version . 2 1.1.2 Technical Terms and Font Conventions . 3 1.2 The Concept in Brief . 3 1.2.1 Advantages of Dynamic Modules . 4 1.2.2 How to Use Modules . 4 1.2.3 How to Write and Create Modules . 6 1.3 Where to Find Further Information . 7 1.4 Challenges and Contributions . 8 2 Modules User Interface 9 2.1 Basic Functions to Access Modules . 9 2.2 Module Domain Representation . 10 2.3 Module Online Documentation . 10 3 Introduction to Module Programming 11 3.1 Module Source Code . 11 3.2 Creating Binary Code . 12 3.3 Predefined Methods and Reserved Names . 12 3.4 Online Documentation File Format . 13 3.4.1 General Information Page . 14 3.4.2 Function Help Pages . 15 4 Inside MuPAD 17 4.1 System Components . 17 4.2 The Kernel . 18 4.3 The Interpreter . 18 4.4 Memory Management System . 19 4.4.1 Internal Data Type MTcell . 19 4.4.2 Signatures . 20 x Contents 4.4.3 Reference Counter . 20 4.4.4 C Memory Management . 21 4.5 Data Types . 21 4.5.1 Special MuPAD Objects . 21 4.5.2 Strings and Identifiers . 22 4.5.3 Booleans . 22 4.5.4 Numbers . 23 4.5.5 Lists, Expressions and Domain Elements . 23 4.5.6 Sets, Tables and Domains . 24 4.5.7 Arrays and Polynomials . 24 4.5.8 Other Data Types . 24 Contents xi 4.6 Displaying MuPAD Objects . 25 4.7 Module Management System . 25 4.7.1 Dynamic, Static and Pseudo Modules . 26 4.7.2 Displacement and Replacement Strategies . 27 4.7.3 Address Evaluation for Kernel Objects . 28 5 Module Generator 31 5.1 Analysis and Code Extension . 32 5.1.1 Inline Options . 32 5.1.2 Module Functions . 33 5.1.3 Module Procedures and Expressions . 33 5.2 Creating Executable Modules . 33 5.2.1 Compiling . 33 5.2.2 Linking . 34 5.2.3 Splitting Module Sources . 34 5.3 Module Debugging . 35 5.4 Module Generator Options .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    238 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us