Adept Scientific - English
The world's best software for research, science and engineering.
flag arrow
clearclear
 

 Adept Store | register Join My Adept | Flags  
Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055  
UKusdedksvnofi
Home
Products
Training
Consultancy
 Buy Online
Downloads
Education
Support
My Adept
International |  About Us |  Contact Us |  Press Room |  Jobs


The Next Steps

• Ask us a question
• Maple Product Tour
• Buy Maple Now
• View Maple Pricing
• Download a Brochure
• Request a Brochure
• Download a Demo
• Request a Demo
• Meet Our Team
• Read our RSS Feeds

Learn More

Maple Home
Maple 12 Professional
Maple 12 Academic
Maple 12 Student Use
Recorded Online Seminars
FREE Training Resources
Maple Application Briefs
Maple Adoption Program

MapleNet
Maple T.A.
MapleConnect
BlockImporter for Simulink
BlockBuilder for Simulink
Maple Toolboxes
Maple Rave Reviews
Maple Study Guides
Books about Maple
System Requirements

Latest Information

New Features: Professional
New Features: Academic
The Maple Reporter Online
Numerical Algorithms Group
(NAG)


Service & Support

Maple Primes
blogs, forums etc

Elite Maintenance Program
Application Centre
Powertools
Search the Knowledge Base
Technical Support request

List Archives >  Maple User Group List Archive >  Archive by date >  This Month By Date >  This Month By Topic

[MUG] operator overloading

Search email archive for  

[MUG] operator overloading
Author: Jarausch    Posted: Thu, 31 Oct 2002 11:15:11 +0100

>> From: "jarausch"

Hi,

as newbee in Maple and coming from C++ (and Scilab and Matlab) I have
some questions on simple "OO"-principles in Maple.

I have noticed that with LinearAlgebra (e.g.) the multiplication '*'
between 2 objects of class Matrix is correctly interpreted as matrix
multiplication. Is this a builtin special case or can one write a module
which does similar things (e.g. arithmetic in a finite field used with
the standard operators +,-,*,/)
Furthermore, is it possible to overload the assignment operator as well
( e.g. if x is an element of a self-grown module F7, then
x=11 should be interpreted as x= 11 mod 7 ?)

Thanks for any hints,

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
Aachen University
D 52056 Aachen, Germany

[MUG] Re: operator overloading
Author: Dr Francis J Wright    Posted: Fri, 1 Nov 2002 17:40:10 -0000

>> From: "Dr Francis J. Wright" "F.J.Wright"

From: "jarausch"
| as newbee in Maple and coming from C++ (and Scilab and Matlab) I have
| some questions on simple "OO"-principles in Maple.
|
| I have noticed that with LinearAlgebra (e.g.) the multiplication '*'
| between 2 objects of class Matrix is correctly interpreted as matrix
| multiplication. Is this a builtin special case or can one write a module
| which does similar things (e.g. arithmetic in a finite field used with
| the standard operators +,-,*,/)

It is more usual to use . for Matrix multiplication; * will not always work.
You can use a module to overload the standard operators, as I discuss in the
final chapter of my book "Computing with Maple" on Object Orientation and
Modules; see http://centaur.maths.qmul.ac.uk/CwM/ for details. I construct
a module to support block matrices as an example. You might like to
download the solutions to the exercises for Chapter 15, which are available
as a Maple 6 worksheet under "Exercise solutions". The block matrix package
is in the form of a plain text file, which is intended to be read into the
Maple worksheet.

| Furthermore, is it possible to overload the assignment operator as well
| ( e.g. if x is an element of a self-grown module F7, then
| x=11 should be interpreted as x= 11 mod 7 ?)

The Maple assignment operator is :=, but I am not aware that it can be
overloaded. This may be connected with the fact that assignments are
statements and not expressions in Maple, unlike in C, etc. (Maple is not an
object-oriented language, although the module facility that was introduced
in Maple 6 supports some object orientation.)

Francis

---

Dr Francis J. Wright
School of Mathematical Sciences, Queen Mary
University of London, Mile End Road, London E1 4NS, UK
Tel: 020 7882 5453 (direct); Fax: 020 8981 9587 (dept.)
"F.J.Wright" http://centaur.maths.qmul.ac.uk/

Previous by date: [MUG] Run out of memory, Robert Fischer
Next by date: [MUG] C switch/case by codegen, Nld
Previous thread: [MUG] Animation of drawing a function point-by-point,  Sandy Yates
Next thread: [MUG] C switch/case by codegen, Nld



Ready to buy?

Maple - single user licence
Add to shopping basket
$ 1,895.00
Upgrade to Maple 12 from v11
Add to shopping basket
$ 995.00
Upgrade to Maple 12 from v10 & below
Add to shopping basket
$ 1,395.00

Featured Downloads

Maple White Paper: Technical Knowledge - An Asset You Can Afford to Lose?
Maple in Electronics Application Pack
Maple in Robotics & Aerospace Application Pack
Maple in Finance Application Pack

Product Reviews

"Without the Maple software, we would have to spend weeks generating the equations of motion for every experiment. Then the chances that we did it right would basically be near zero. There would always be a mistake somewhere. It is very difficult to set up a dynamic motion model by hand."
- Jean-Claude PiedBeouf, Ph.D Manager of Robotics, Canadian Space Agency

"Its very good - highly accurate and easy to use. The speed of Maple allows me to change equations and quickly reintegrate them into the application, so more possibilities can be explored to achieve the precise effect desired."
Shawn Neely, Senior R & D Director for PDI/Dreamworks
adept

Top of the Page

Our Privacy and Terms and Conditions Statement
All Trademarks Recognised. Copyright © 2007, Adept Scientific plc.
Site designed and maintained by Adeptise

Adept Scientific | Amor Way | Letchworth Garden City | Herts | SG6 1ZA | Tel: +44 (0)1462 480055