Generic, open and powerful Marc Moreno Maza September 1, 2006 1 - - PowerPoint PPT Presentation

generic open and powerful
SMART_READER_LITE
LIVE PREVIEW

Generic, open and powerful Marc Moreno Maza September 1, 2006 1 - - PowerPoint PPT Presentation

Generic, open and powerful Marc Moreno Maza September 1, 2006 1 An introductory example Z := Integer (1) Integer Type: Domain Time: 0 sec Q := Fraction Z (2) Fraction Integer Type: Domain Time: 0 sec P := Polynomial Q (3) Polynomial


slide-1
SLIDE 1

Generic, open and powerful

Marc Moreno Maza September 1, 2006

1

slide-2
SLIDE 2

An introductory example

Z := Integer (1) Integer Type: Domain Time: 0 sec Q := Fraction Z (2) Fraction Integer Type: Domain Time: 0 sec P := Polynomial Q (3) Polynomial Fraction Integer Type: Domain Time: 0 sec K := Fraction P (4) Fraction Polynomial Fraction Integer Type: Domain Time: 0 sec

2

slide-3
SLIDE 3

M := SquareMatrix(4, K) (5) SquareMatrix(4,Fraction Polynomial Fraction Integer) Type: Domain Time: 0 sec quaternion(a: K, b: K, c: K, d: K): M == matrix ([[d , a , b , c], [-a , d ,

  • c ,

b], [-b , c , d ,

  • a],

[-c ,

  • b ,

a , d ]]) Function declaration quaternion : (Fraction Polynomial Fraction Integer,Fraction Polynomial Fraction Integer, Fraction Polynomial Fraction Integer,Fraction Polynomial Fraction Integer) -> SquareMatrix(4,Fraction Polynomial Fraction Integer) has been added to workspace.

3

slide-4
SLIDE 4

q := quaternion(1,2,3,x/y) + x + | - 1 2 3 | | y | | | | x | |- 1

  • 3

2 | | y | (7) | | | x | |- 2 3

  • 1|

| y | | | | x | |- 3

  • 2

1

  • |

+ y +

4

slide-5
SLIDE 5

recip(q) + 1 1 2 1 2 3 2 + |

  • - x y
  • - y
  • y
  • - y

| | 14 14 7 14 | |----------

  • ----------
  • ----------
  • ----------|

| 2 1 2 2 1 2 2 1 2 2 1 2| |y + -- x y + -- x y + -- x y + -- x | | 14 14 14 14 | | | | 1 2 1 3 2 1 2 | |

  • - y
  • - x y
  • - y
  • y

| | 14 14 14 7 | |----------

  • ----------|

| 2 1 2 2 1 2 2 1 2 2 1 2| |y + -- x y + -- x y + -- x y + -- x | | 14 14 14 14 | (8) | | | 1 2 3 2 1 1 2 | |

  • y
  • - y
  • - x y
  • - y

| | 7 14 14 14 | |----------

  • ----------
  • --------- |

| 2 1 2 2 1 2 2 1 2 2 1 2 | |y + -- x y + -- x y + -- x y + -- x | | 14 14 14 14 | | | | 3 2 1 2 1 2 1 | |

  • - y
  • y
  • - y
  • - x y

| | 14 7 14 14 | |----------

  • ----------
  • --------- |

| 2 1 2 2 1 2 2 1 2 2 1 2 | |y + -- x y + -- x y + -- x y + -- x | + 14 14 14 14 + Type: Union(SquareMatrix(4,Fraction Polynomial Fraction Integer),...) Time: 0.05 (EV) + 0.02 (OT) + 0.01 (GC) = 0.08 sec

5

slide-6
SLIDE 6

quaternion(1,2,3,q) Cannot convert from type SquareMatrix(4,Fraction Polynomial Fraction Integer) to Fraction Polynomial + x + | - 1 2 3 | | y | | | | x | |- 1

  • 3

2 | | y | | | | x | |- 2 3

  • 1|

| y | | | | x | |- 3

  • 2

1

  • |

+ y +

6

slide-7
SLIDE 7

A brief history

  • The Scratchpad projects were developed since 1971 by IBM under the

direction of Richard Jenks.

  • Scratchpad 2 was considered as a research platform for developing new

ideas in computational mathematics.

  • From 1991, ALDOR, an extension language for Scratchpad 2 was

developed under the lead of Stephen Watt.

  • In 1990s, the Scratchpad 2 project was renamed to AXIOM. It was sold to

the Numerical Algorithms Group (NAG) and became a commercial system.

  • AXIOM was withdrawn from the market in October, 2001.
  • NAG agreed to release AXIOM and ALDOR as free software.
  • Today, the efforts of the AXIOM community are coordinated by Tim Daly.

Those around ALDOR are organized at ORCCA.

7

slide-8
SLIDE 8

More recently

  • Released under Modified BSD License in Sept. 2002.
  • GNU Common Lisp port from Codemist Common Lisp
  • Literate rewrite; Algebra code released in Sept. 2003
  • Electronic Book released in April 2004
  • Graphics released in Sept. 2004
  • Browser released in Dec. 2004
  • Feature complete release in Feb. 2005
  • Introducing fast arithmetic and parallelism in AXIOM/ALDOR (Yuzhen Xie,

Xin Li and Akpodigha Filatei)

8

slide-9
SLIDE 9

A few data

  • Approximately 3.6 million lines of source, including documentation.
  • The whole system takes about 8 hours to build on a 1Ghz machine.
  • Free and Open Source software maintained on several servers:
  • savannah, by courtesy of the Free Software Foundation,
  • sourceforge, by courtesy of the Open Source Technology Group,
  • axiom-developer.org, by Tim Daly, with support from the Center for

Algorithms and Interactive Scientific Software (CAISS) at the City College of New York.

  • AXIOM has 82 registered developers and 22 of them have write access to the

source code.

  • Direct contributions, over 35 years, of approximately 164 people.

9

slide-10
SLIDE 10

AXIOM contributors

Cyril Alberga Roy Adler Richard Anderson George Andrews Henry Baker Stephen Balzac Yurij Baransky David R. Barton Gerald Baumgartner Gilbert Baumslag Fred Blair Mark Botch Alexandre Bouyer Peter A. Broadbery Martin Brock Manuel Bronstein Florian Bundschuh William Burge Robert Caviness Bruce Char Cheekai Chin David V. Chudnovsky Gregory V. Chudnovsky Josh Cohen Don Coppersmith George Corliss Robert Corless Gary Cornell Timothy Daly Sr. Timothy Daly Jr. James H. Davenport Jean Della Dora Michael Dewar Claire DiCrescendo

10

slide-11
SLIDE 11

Sam Dooley Lionel Ducos Martin Dunstan Brian Dupee Dominique Duval Robert Edwards Lars Erickson Richard Fateman Bertfried Fauser Stuart Feldman Brian Ford Albrecht Fortenbacher George Frances Timothy Freeman Korrinn Fu Marc Gaetano Rudiger Gebauer Patricia Gianni Holger Gollan Teresa Gomez-Diaz Laureano Gonzalez-V Stephen Gortler Johannes Grabmeier Matt Grayson James Griesmer Vladimir Grinberg Oswald Gschnitzer Steve Hague Vilya Harvey Satoshi Hamaguchi Martin Hassner Henderson Pietro Iglio

11

slide-12
SLIDE 12

Richard Jenks Grant Keady Tony Kennedy Klaus Kusche Bernhard Kutzler Larry Lambe Frederic Lehobey Michel Levaud Xin Li Rudiger Loos Michael Lucks Richard Luczak Camm Maguire Bob McElrath Michael McGettrick Ian Meikle David Mentre Victor S. Miller Gerard Milmeister Mohammed Mobarak

  • H. Michael Moeller

Michael Monagan Marc Moreno Maza Scott Morrison Mark Murray William Naylor

  • C. Andrew Neff

John Nelder Godfrey Nolan Arthur Norman

12

slide-13
SLIDE 13

Michael O’Connor Julian A. Padget Bill Page Susan Pelzel Michel Petitot Didier Pinchon Claude Quitte Norman Ramsey Michael Richardson Renaud Rioboo Jean Rivlin Simon Robinson Michael Rothstein Philip Santas Alfred Scheerhorn William Schelter Gerhard Schneider Martin Schoenert Marshall Schor Fritz Schwarz Nick Simicich William Sit Jonathan Steinbach Christine Sundaresan Robert Sutor Moss E. Sweedler Eugene Surowitz James Thatcher Dylan Thurston Barry Trager

13

slide-14
SLIDE 14

Themos T. Tsikas Bernhard Wall Stephen Watt Juergen Weiss

  • M. Weller

Mark Wegman James Wen Thorsten Werther John M. Wiley Berhard Will Clifton J. Williamson Shmuel Winograd Robert Wisbauer Waldemar Wiwianka Knut Wolf David Yun Richard Zippel Bruno Zuercher Dan Zwillinger

14

slide-15
SLIDE 15

AXIOM: Genericity

Being able to implement mechanisms for producing new algebraic structures from existing ones: (1) R = Z, (2) n − → Z/nZ, (3) (R, X) − → R[X], (4) (R, p) − → R/pR (5) R − → Fr(R), (6) (R1, R2) − → R1 × R2. Including conditional statements like:

  • If R is commutative, then R[X] is commutative.
  • If R is an integral domain, then Fr(R) is a field.

15

slide-16
SLIDE 16 ExpressionType FreeLinearCombinationType R LinearArithmeticType R LinearCombinationType R AbelianGroup AbelianMonoid Module R IndexedFreeLinearArithmeticType(R,E) IndexedFreeModule(R,E) MatrixCategory R FreeModule R FreeLinearArithmeticType R IndexedFreeLinearCombinationType(R,E) MonogeneticLinearArithmeticType R UnivariateTaylorSeriesCategory R Algebra R Monoid Ring FreeAlgebra R IndexedFreeAlgebra(R,E) PolynomialRing0(R,V) NonCommutativeIntegralDomain Specializable UnivariatePolynomialQuotient(R,Rx) CommutativeRing GcdDomain EuclideanDomain Field FiniteSet DifferentialExtension R IntegralDomain DifferentialRing FractionCategory R SimpleAlgebraicExtension(R,Rx) LinearAlgebraRing FiniteCharacteristic PrimeFieldCategory0 FractionByCategory0 R FractionByCategory R FactorizationRing PrimeFieldCategory FractionFieldCategory0 R FiniteField Group FFTRing Parsable RationalRootRing UnivariateGcdRing UnivariatePolynomialCategory R UnivariatePolynomialCategory0 R UnivariatePolynomialAlgebra R RecursiveMultivariatePolynomialCategory0(R,V) DecomposableRing UnivariatePolynomialQuotientSqrf(R,Rx) PolynomialRing(R,V) FiniteAbelianMonoidRing0(R,V,E) MonogeneticAlgebra R DirectProductCategory(dim,T) GeneralExponentCategory ExponentCategory V MachineIntegerExponentVectorCategory V IntegerExponentVectorCategory V IntegerCategory SmallPrimeFieldCategory0 SmallPrimeFieldCategory FractionFieldCategory R RittRing CharacteristicZero PrimeTable PrimeCollection ExpressionTreeOperator Evaluator R PartialRing LinearCombinationFraction(R,LR,Q,LQ) LinearEliminationCategory(R,M) ReducibleModulusExceptionType R VariableType FiniteVariableType PrimitiveType PartiallyOrderedType TotallyOrderedType AdditiveType ArithmeticType OrderedArithmethicType OutputType FloatType BooleanArithmeticType HashType IntegerType BoundedFiniteDataStuctureType T LinearStructureType T DataStructureType T CopyableType SerializablType InputType TableType(K,V) FiniteLinearStructureType T BoundedFiniteLinearStructureType T DynamicDataStructureType T ArrayType(T,PT) ListType T PrimitiveArrayType T PackableType VersionInformationType GeneratorExceptionType RunTimeException ArrayExceptionType ListExceptionType TableExceptionType FileExceptionType SyntaxExceptionType

16

slide-17
SLIDE 17

AXIOM: A laboratory for the mathematician

17

slide-18
SLIDE 18

AXIOM: Free and open source

18

slide-19
SLIDE 19

Literate programming

  • A literate program should combine the explanation of the code with the actual

code.

  • Programming becomes a task of writing for other people rather than the

machine.

  • Literate programming was made famous by Knuth who originally created Web

for Pascal programs.

  • Norman Ramsey (Harvard) created noweb which is language independent.
  • Axiom uses noweb to make every file into a literate program.
  • As a result all files in Axiom are meant to be document.
  • weave is a command
  • to extract the latex source code,
  • which can help preparing a technical report.

19

slide-20
SLIDE 20

AXIOM: a multiple-level programming environment

Spad

Lisp C Assembly code

20

slide-21
SLIDE 21

The SPAD language

ResidueRing(F,Expon,VarSet,FPol,LFPol) : Dom == Body where F : Field Expon : OrderedAbelianMonoidSup VarSet : OrderedSet FPol : PolynomialCategory(F, Expon, VarSet) LFPol : List FPol Dom == Join(CommutativeRing, Algebra F) with reduce : FPol -> $ ++ reduce(f) produces the equivalence class of f in the resi coerce : FPol -> $ ++ coerce(f) produces the equivalence class of f in the resi lift : $

  • > FPol

++ lift(x) return the canonical representative of the equiva Body == add

  • -representation

Rep:= FPol import GroebnerPackage(F,Expon,VarSet,FPol)

21

slide-22
SLIDE 22

relations:= groebner(LFPol) relations = [1] => error "the residue ring is the zero ring

  • -declarations

x,y: $

  • -definitions

0 == 0$Rep 1 == 1$Rep reduce(f : FPol) : $ == normalForm(f,relations) coerce(f : FPol) : $ == normalForm(f,relations) lift x == x :: Rep :: FPol x + y == x +$Rep y

  • x == -$Rep x

x*y == normalForm(lift(x *$Rep y),relations) (n : Integer) * x == n *$Rep x (a : F) * x == a *$Rep x x = y == x =$Rep y characteristic() == characteristic()$F coerce(x) : OutputForm == coerce(x)$Rep

22

slide-23
SLIDE 23

A multiple-level programming environment (I)

Assembly code

OO flavor Generic progr. Functional progr Close to machine Machine access Interoperability with other libs Architecture specific features Statically typed

  • Dynamic. typed

Register alloc..

C Common Lisp Spad

23

slide-24
SLIDE 24

A multiple-level programming environment (II)

C Assembly code

OO flavor Generic progr. Functional progr Close to machine Machine access Interoperability with other libs Architecture specific features and abstract algorithms Complex d.−str, Specialized algorithms Fundamental data−structures Specialized algorithms

  • perations in
  • r over Z/pZ

Efficiency critic Statically typed

  • Dynamic. typed

Register alloc.

Common Lisp Spad

High−level

24

slide-25
SLIDE 25

A few words on ALDOR

  • Some expertise is required in order to interface AXIOM with external packages.
  • Developing stand-alone binaries (e.g. servers in a distributed/parallel

application) is not purpose of AXIOM.

  • ALDOR was initially developed to extend AXIOM via LISP and solve these

difficulties.

  • ALDOR has also its own libraries:
  • aldorlib and algebra general purpose libraries for computer algebra,
  • sumˆ

ıt for manipulating and solving linear ordinary differential and difference equations and systems

  • BasicMath initiated at NAG in the 1990’s and developed today at ORCCA;

BasicMath supports a parallel symbolic polynomial system solver

  • Calix for involutive bases in commutative and non-commutative

polynomial rings.

  • etc.

25

slide-26
SLIDE 26

Fast vs standard arithmetic

2 4 6 8 10 12 14 200 400 600 800 1000 1200 Time [sec] Polynomial Degrees CRA Fast CRA

CRA for univariate polynomials in Z/pZ[x] for p a 27-bit prime in ALDOR.

26

slide-27
SLIDE 27

We care about a factor of 2

0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 200 400 600 800 1000 1200 1400 1600 1800 2000 Time [sec] Polynomial Degrees Generic Specialized

Standard EEA in Z/pZ[x] for a 27-bit prime: generic vs specialized code in ALDOR.

27

slide-28
SLIDE 28

C-level vs ALDOR implementations

0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1K 2K 3K 4K 5K 6K 7K 8K Time [sec] Degree (K=1000) ALDOR NTL

Fast EEA in Z/pZ[x] for p a 27-bit prime: generic ALDOR vs specialized C code.

28

slide-29
SLIDE 29

With AXIOM

0.05 0.1 0.15 0.2 0.25 0.3 5000 10000 15000 20000 25000 30000 35000 Time [sec] Degree ALDOR MAGMA NTL AXIOM

FFT-based multiplication in Z/pZ[x] for a 27-bit prime.

29

slide-30
SLIDE 30

Conclusions and future work

  • The AXIOM/ALDOR language remains a beautiful tool for implementing

abstract and generic mathematical algorithms.

  • An active community of people has turned AXIOM into a free and open

computer algebra system.

  • AXIOM and ALDOR appear today as platforms for high-performance

computing.

30

slide-31
SLIDE 31

Bibliography

  • AXIOM http://page.axiom-developer.org
  • ALDOR http://www.aldor.org
  • GMP http://swox.com/gmp/
  • GNU Common Lisp http://www.gnu.org/software/gcl
  • MAGMA http://magma.maths.usyd.edu.au/magma/
  • NTL http://www.shoup.net/ntl

31