How fast can we multiply and divide polynomials?

Size: px
Start display at page:

Download "How fast can we multiply and divide polynomials?"

Transcription

1 How fast can we multiply and divide polynomials? Cybernet Systems, December 14, Michael Monagan Center for Experimental and Constructive Mathematics, Simon Fraser University, Vancouver, British Columbia, CANADA. Joint work with Roman Pearce.

2 The Mathematics Of Computer Algebra and Analysis project. > factor(2 x 3 + x 2 y 2 x 3 y + x 2 5 yx 3 y y 2 x 3 y 1); > solve({x 2 + y 2 + z 2 4, x y z + 2, x y + z 3 1}); t 1 2 t 1 > Determinant( t 2 t 1 ); 1 + t t + t 2 > x 2 ln(x)e x + (1 x) ln(x)e x 2xe x dx;

3 The Mathematics Of Computer Algebra and Analysis project. > factor(2 x 3 + x 2 y 2 x 3 y + x 2 5 yx 3 y y 2 x 3 y 1); > solve({x 2 + y 2 + z 2 4, x y z + 2, x y + z 3 1}); t 1 2 t 1 > Determinant( t 2 t 1 ); 1 + t t + t 2 > x 2 ln(x)e x + (1 x) ln(x)e x 2xe x dx; Risch e x θ 1 ln x θ 2 a polynomial {}}{ x 2 θ 2 θ 1 + (1 x)θ 2 θ 1 2xθ 1 dx where θ 1 = θ 1 θ 2 = 1/x.

4 Polynomials are the key! Talk Outline: How do CAS represent polynomials? How do CAS multiply and divide polynomials? Our representation and algorithms. How fast we compared with other CAS? Immediate Monomial Project (for Maple 15) Parallel Multiplication (for Maple 15)

5 How do CAS represent polynomials?

6 Recursive and distributed polynomial representations. The distributed represention: monomials x i y j z k are sorted in lexicographical order (Magma, Mathematica): f = 6x 3 + 9xy 3 z 8xy 2 z + 7y 2 z or graded lex order (Singular, Maple 15): f = 9xy 3 z 8xy 2 z + 7y 2 z 2 6x Key property: if X, Y, Z are monomials then Y > Z = XY > XZ.

7 Recursive and distributed polynomial representations. The distributed represention: monomials x i y j z k are sorted in lexicographical order (Magma, Mathematica): f = 6x 3 + 9xy 3 z 8xy 2 z + 7y 2 z or graded lex order (Singular, Maple 15): f = 9xy 3 z 8xy 2 z + 7y 2 z 2 6x Key property: if X, Y, Z are monomials then Y > Z = XY > XZ. The recursive representation (Macsyma, REDUCE, Derive, Pari): f = ( 6)x 3 + ((9z)y 3 + ( 8z)y 2 )x 1 + ((7z 2 )y 2 + 5y 0 )x 0.

8 Maple s sum of products representation. PROD 7 x 1 y 3 z 1 PROD 5 y 3 z 2 PROD 7 x 1 y 2 z 1 PROD 3 x 3 SUM xy 3 z 4y 3 z 2 6xy 2 z 8x 3 5 Singular s distributed representation. POLY x y z

9 Trip s recursive sparse representation. POLY x POLY y POLY y 2 3 POLY z 2 4 POLY z 1 6 POLY z 1 9 ( 5y 4z 2 y 3 ) + ( 6zy 2 + 9zy 3 )x 8x 3 Pari s recursive dense representation POLY 6 x 0 8 POLY 6 y POLY 6 y POLY 5 z POLY 4 z 0 6 POLY 4 z 0 9

10 Our representation uses packed monomials. Packing for x i y j z k in graded lex order with x > y > z: Why? One 64 bit word : i + j + k i j k. }{{} (i + j + k) i j + k.

11 Our representation uses packed monomials. Packing for x i y j z k in graded lex order with x > y > z: One 64 bit word : i + j + k i j k. }{{} (i + j + k) i j + k. Why? Because monomial > and are one machine instruction.

12 Our representation uses packed monomials. Packing for x i y j z k in graded lex order with x > y > z: One 64 bit word : i + j + k i j k. }{{} (i + j + k) i j + k. Why? Because monomial > and are one machine instruction. Our packed array for 9xy 3 z 4y 3 z 2 6xy 2 z 8x 3 5. POLY 5 x y z packing d = total degree dxyz dxyz dxyz dxyz dxyz Why graded lex order?

13 Our representation uses packed monomials. Packing for x i y j z k in graded lex order with x > y > z: One 64 bit word : i + j + k i j k. }{{} (i + j + k) i j + k. Why? Because monomial > and are one machine instruction. Our packed array for 9xy 3 z 4y 3 z 2 6xy 2 z 8x 3 5. POLY 5 x y z packing d = total degree dxyz dxyz dxyz dxyz dxyz Why graded lex order? No exponent overflow in division.

14 How do CAS multiply and divide polynomials?

15 Let f = f 1 + f f n and g = g 1 + g g m where f 1 > f 2 > > f n and g 1 > g 2 > > g m. Using h = f g = ((f 1 g + f 2 g) + f 3 g) + + f n g and h g = f : (((h f 1 g) f 2 g) f 3 g) f n g

16 Let f = f 1 + f f n and g = g 1 + g g m where f 1 > f 2 > > f n and g 1 > g 2 > > g m. Using h = f g = ((f 1 g + f 2 g) + f 3 g) + + f n g and h g = f : (((h f 1 g) f 2 g) f 3 g) f n g takes O(n 2 m) comparisons of monomials and O(nm) multiplications of coefficient and monomials. Example: f = x n + x n x and g = y n + y n y.

17 Our algorithms for multiplication and division use heaps.

18 Heaps A binary heap H with n entries is a partially ordered array satisfying H i H 2i and H i H 2i+1. H 1 H 2 H 3 H 4 H 5 H 6 H 7 H H 1 is the biggest entry in a heap. We can extract the maximum entry in O(log 2 n) comparisons. We can insert a new entry in O(log 2 n) comparisons.

19 Multiplication using a binary heap. Johnson, 1974, a simultaneous n-ary merge: f = a 1 X 1 + a 2 X a n X n g = b 1 Y 1 + b 2 Y b m Y m (sorted) add f 2 g 1 f 1 g f 1 g2 Heap f 1 x f 2 x f 3 x fn x ( g 1 + g 2 + g g m) ( g 1 + g 2 + g g m) ( g 1 + g 2 + g g m). ( g 1 + g 2 + g g m ) O(nm log n) comparisons. Space for n monomials in the heap. Can pick n m.

20 Division using a heap. Johnson s quotient heap algorithm. Dividing f g = q compute f #q q i g i=1 O(#f + #q#g log #q) comparisons O(#q) working memory Our divisor heap algorithm. Dividing f g = q compute f #g g i q i=2 O(#f + #q#glog #g) comparisons O(#g) working memory

21 Minimal heap division (Monagan & Pearce, 2008) Problem: we don t know if #q > #g when starting a division. E.g. (x 7 y 7 ) (x y) = x 6 + yx 5 + y 2 x y 6. Start with quotient heap, switch to divisor heap when #q = #g. f min(#q,#g) i=1 q i g }{{} quotient heap #g g i (q #g+1 + ) i=2 } {{ } divisor heap O(#f + #q#glog min(#q, #g)) comparisons O(min(#q, #g)) working memory

22 Which CAS is fastest?

23 Benchmark 1: A dense Fateman problem. f = (1 + x + y + z + t) 20 g = f + 1 f and g have 39 bit coefficients and 10,626 terms h = f g has 83 bit coefficients and 135,751 terms Intel Core2 3.0 GHz multiply divide p = f g q = p/f Maple s s Maple s s Singular s s Magma V s s Pari (w/ GMP) s s Trip v s - sdmp (unpacked) 5.15 s 5.44 s sdmp (packed) 2.26 s 2.77 s Maple s 4.46s

24 Benchmark 2: A sparse 10 variable problem. f = (x 1 x 2 + x 2 x 3 + x 3 x 4 + x 4 x 5 + x 5 x 6 + x 6 x 7 + x 7 x 8 + x 8 x 9 + x 9 x 10 + x 1 x 10 + x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 + x 8 + x 9 + x ) 4 g = (x x x x x x x x x x x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 + x 8 + x 9 + x ) 4 6, 746 8, 361 = multiply p = f g divide q = p/f 3, 157, 883 terms seconds secs Maple s s Maple s s Singular s 18.00s Magma V s s Pari (w/ GMP) 7.06s 7.05s Trip v0.99 (rationals) 8.13s sdmp (unpacked) 11.12s 10.37s sdmp (packed) 2.46s 2.61s Maple s 14.45s

25 Benchmark 3: Factorization speedup in Maple 14. In Maple 13, > h := expand(f*g); > divide(h,f, q ); call expand/bigprod (f,g) and expand/bigdiv (h,f,q) for large inputs. In Maple 14, we reprogrammed expand/bigprod and expand/bigdiv to convert to SDMP, multiply (divide) in SDMP, then convert back to Maple. Benchmark factor( h ) where h = (a + 1)(a + 2) a = Maple13 Magma Maple14 Speedup (x + y + z) x (1 + x + y + z) x (1 + x + y + z) x (1 + x + y + z + t) x Table: Factorization Benchmark Timings (in CPU seconds)

26 The Immediate Monomial Project. A joint MITACS project with Maplesoft. A new data structure being implemented by Paul de Marco. POLY SEQ 4 X Y Z How will we pack monomials? E.g. x i y j z k on a 64 bit computer. Always try to pack all monomials into one word. If i + j + k < 2 16 pack i + j + k i j k in one word. If i + j + k 2 16 use Maple s existing representation. So the number of variables determines the packing.

27 The Immediate Monomial Project POLY SEQ 4 X Y Z Let f (x 1, x 2,, x n ) = f 1 + f f m. O(nm) O(1) : lcoeff(f); degree(f); indets(f); O(nm) O(n) : f; has(f,x); type(f,polynom(integer)); O(nm) O(m) : degree(f,x); diff(f,x); coeffs(f,x); A 10 20% gain in overall efficiency gain for Maple 14?

28 Parrallelizing Multiplication Using Heaps Intel Core i7.

29 Parallel Algorithm One heap per core, merge results in a global heap. Global Heap Local Heaps f g 4 Don t waste real or cpu time: partition terms transfer data balance load

30 Transferring Data Threads write to a finite circular buffer. 0 N 1 r w r mod N w mod N #define N /* size in words (256 K) */ #define CLINE 64 /* bytes per cache line */ struct buffer { long r; /* words read */ char pad1[cline - sizeof(long)]; long w; /* words wrote */ char pad2[cline - sizeof(long)]; long data[n]; }; 32K L1 32K L1 32K L1 32K L1 256K L2 256K L2 256K L2 256K L2 8MB Shared L3 Intel Core i7

31 Load Balancing Global Heap Local Heaps f g 4 threads try to acquire a lock for the global heap one thread per core avoids context switches and OS threads independently adjust their share of global work buffer full do more global work buffer empty do less global work

32 Dense Benchmark f = (1 + x + y + z + t) 30 g = f = terms W (f, g) = 3332 threads Core i7 2.66GHz Core 2 2.4GHz sdmp s 6.15x s 4.25x (packed) s 4.24x s 3.10x s 2.50x s 2.13x s s s 3.89x s 3.94x Trip 1.0 beta s 2.97x s 2.97x recursive dense s 1.98x s 1.99x s s s 3.26x s 3.38x Trip 1.0 beta s 2.66x s 2.71x recursive sparse s 1.88x s 1.91x s s Magma s Pari/GP s s Singular s s Maple s s

33 Parallel Speedup: Core i7 6 W(f,g) = 2737 : terms parallel speedup W(f,g) = 2040 : terms W(f,g) = : terms W(f,g) = : 1.63 M terms W(f,g) = : 3.09 M terms W(f,g) = : 6.01 M terms W(f,g) = : 11.4 M terms W(f,g) = : 18.4 M terms W(f,g) = : 32.7 M terms W(f,g) = : 49.3 M terms W(f,g) = : 65.7 M terms dense sparse random univariate polynomials = products linear terms 5x terms threads 3 4

Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors

Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors Michael Monagan and Roman Pearce Department of Mathematics, Simon Fraser University Burnaby, B.C. V5A 1S6, CANADA. mmonagan@cecm.sfu.ca

More information

Parallel Sparse Polynomial Multiplication Using Heaps

Parallel Sparse Polynomial Multiplication Using Heaps Parallel Sparse Polynomial Multiplication Using Heaps Michael Monagan Department of Mathematics Simon Fraser University Burnaby, B.C. V5A 1S6, CANADA. mmonagan@cecm.sfu.ca Roman Pearce Department of Mathematics

More information

Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors

Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors Polynomial Division using Dynamic Arrays, Heaps, and Packed Exponent Vectors Michael Monagan and Roman Pearce Department of Mathematics, Simon Fraser University Burnaby, B.C. V5A 1S6, CANADA. mmonagan@cecm.sfu.ca

More information

POLY : A new polynomial data structure for Maple

POLY : A new polynomial data structure for Maple POLY : A new polynomial data structure for Maple Michael Monagan and Roman Pearce mmonagan@cecm.sfu.ca and rpearcea@cecm.sfu.ca Department of Mathematics, Simon Fraser University Burnaby B.C. V5A S6, Canada

More information

A new edge selection heuristic for computing the Tutte polynomial of an undirected graph.

A new edge selection heuristic for computing the Tutte polynomial of an undirected graph. FPSAC 2012, Nagoya, Japan DMTCS proc. (subm.), by the authors, 1 12 A new edge selection heuristic for computing the Tutte polynomial of an undirected graph. Michael Monagan 1 1 Department of Mathematics,

More information

Mathematics and Algorithms for Computer Algebra

Mathematics and Algorithms for Computer Algebra Mathematics and Algorithms for Computer Algebra Part 1 c 1992 Dr Francis J. Wright CBPF, Rio de Janeiro July 9, 2003 Abstract This course will be mainly mathematics, some computer science and a little

More information

arxiv: v1 [cs.dm] 24 Sep 2012

arxiv: v1 [cs.dm] 24 Sep 2012 A new edge selection heuristic for computing the Tutte polynomial of an undirected graph. arxiv:1209.5160v1 [cs.dm] 2 Sep 2012 Michael Monagan Department of Mathematics, Simon Fraser University mmonagan@cecms.sfu.ca

More information

Form 101 Part II: Research Proposal

Form 101 Part II: Research Proposal Form 101 Part II 1 Monagan 195283 Form 101 Part II: Research Proposal Synopsis Provide a concise overview of the scientific and technical objectives, approach, and the new knowledge, expertise, or technology

More information

Performance. frontend. iratrecon - rational reconstruction. sprem - sparse pseudo division

Performance. frontend. iratrecon - rational reconstruction. sprem - sparse pseudo division Performance frontend The frontend command is used extensively by Maple to map expressions to the domain of rational functions. It was rewritten for Maple 2017 to reduce time and memory usage. The typical

More information

Section 1.8. Simplifying Expressions

Section 1.8. Simplifying Expressions Section 1.8 Simplifying Expressions But, first Commutative property: a + b = b + a; a * b = b * a Associative property: (a + b) + c = a + (b + c) (a * b) * c = a * (b * c) Distributive property: a * (b

More information

CS6303 COMPUTER ARCHITECTURE LESSION NOTES UNIT II ARITHMETIC OPERATIONS ALU In computing an arithmetic logic unit (ALU) is a digital circuit that performs arithmetic and logical operations. The ALU is

More information

COSEQUENTIAL PROCESSING (SORTING LARGE FILES)

COSEQUENTIAL PROCESSING (SORTING LARGE FILES) 10 COSEQUENTIAL PROCESSING (SORTING LARGE FILES) Copyright 2004, Binnur Kurt Content Cosequential Processing and Multiway Merge Sorting Large Files (External Sorting) 255 Cosequential Processing & Multiway

More information

16.50 RANDPOLY: A random polynomial generator

16.50 RANDPOLY: A random polynomial generator 743 16.50 RANDPOLY: A random polynomial generator This package is based on a port of the Maple random polynomial generator together with some support facilities for the generation of random numbers and

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

Exponent Properties: The Product Rule. 2. Exponential expressions multiplied with each other that have the same base.

Exponent Properties: The Product Rule. 2. Exponential expressions multiplied with each other that have the same base. Exponent Properties: The Product Rule 1. What is the difference between 3x and x 3? Explain in complete sentences and with examples. 2. Exponential expressions multiplied with each other that have the

More information

Draw a diagram of an empty circular queue and describe it to the reader.

Draw a diagram of an empty circular queue and describe it to the reader. 1020_1030_testquestions.text Wed Sep 10 10:40:46 2014 1 1983/84 COSC1020/30 Tests >>> The following was given to students. >>> Students can have a good idea of test questions by examining and trying the

More information

Module 7 Highlights. Mastered Reviewed. Sections ,

Module 7 Highlights. Mastered Reviewed. Sections , Sections 5.3 5.6, 6.1 6.6 Module 7 Highlights Andrea Hendricks Math 0098 Pre-college Algebra Topics Degree & leading coeff. of a univariate polynomial (5.3, Obj. 1) Simplifying a sum/diff. of two univariate

More information

Nemo: a computer algebra package for Julia

Nemo: a computer algebra package for Julia TU Kaiserslautern July 12, 2017 Introducing A computer algebra package for the Julia programming language. http://nemocas.org/ Background 2006 David Harvey and I began the Flint C library for fast arithmetic

More information

Math 1 Variable Manipulation Part 2 Exponents & Roots

Math 1 Variable Manipulation Part 2 Exponents & Roots Math 1 Variable Manipulation Part 2 Exponents & Roots 1 PRE-ALGEBRA REVIEW: WORKING WITH EXPONENTS Exponents are shorthand for repeated multiplication of the same thing by itself. For instance, the shorthand

More information

A new edge selection heuristic for computing the Tutte polynomial of an undirected graph.

A new edge selection heuristic for computing the Tutte polynomial of an undirected graph. FPSAC 2012, Nagoya, Japan DMTCS proc. (subm.), by the authors, 1 12 A new edge selection heuristic for computing the Tutte polynomial of an undirected graph. Michael Monagan 1 1 Department of Mathematics,

More information

Efficient AND/OR Search Algorithms for Exact MAP Inference Task over Graphical Models

Efficient AND/OR Search Algorithms for Exact MAP Inference Task over Graphical Models Efficient AND/OR Search Algorithms for Exact MAP Inference Task over Graphical Models Akihiro Kishimoto IBM Research, Ireland Joint work with Radu Marinescu and Adi Botea Outline 1 Background 2 RBFAOO

More information

Learning Packet. Lesson 6 Exponents and Rational Functions THIS BOX FOR INSTRUCTOR GRADING USE ONLY

Learning Packet. Lesson 6 Exponents and Rational Functions THIS BOX FOR INSTRUCTOR GRADING USE ONLY Learning Packet Student Name Due Date Class Time/Day Submission Date THIS BOX FOR INSTRUCTOR GRADING USE ONLY Mini-Lesson is complete and information presented is as found on media links (0 5 pts) Comments:

More information

Wits Maths Connect Secondary Project Card-sorting Activities

Wits Maths Connect Secondary Project Card-sorting Activities Project Card-sorting Activities This pack consists of card-sorting activities which focus on working with different representations. Activities and focus on points while Activity focuses on the linear

More information

Working with Rational Expressions

Working with Rational Expressions Working with Rational Expressions Return to Table of Contents 4 Goals and Objectives Students will simplify rational expressions, as well as be able to add, subtract, multiply, and divide rational expressions.

More information

Beating Hand-Tuned Assembly. David Richardson

Beating Hand-Tuned Assembly. David Richardson Beating Hand-Tuned Assembly David Richardson d.g.richardson@gmail.com Outline Problem Hand tuned assembly Faster than assembly All optimization is like this 2 Multi Precision Arithmetic 11111111111111

More information

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix Spring 2010 Review Topics Big O Notation Heaps Sorting Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix Hashtables Tree Balancing: AVL trees and DSW algorithm Graphs: Basic terminology and

More information

Computer Science Foundation Exam

Computer Science Foundation Exam Computer Science Foundation Exam May 19, 2018 Section I A DATA STRUCTURES SOLUTION NO books, notes, or calculators may be used, and you must work entirely on your own. Name: UCFID: NID: Question # Max

More information

An Efficient Computer Algebra System for Python

An Efficient Computer Algebra System for Python An Efficient Computer Algebra System for Python Pearu Peterson pearu.peterson@gmail.com Laboratory of Systems Biology, Institute of Cybernetics, Estonia Introduction Design criteria Sympycore architecture

More information

Efficient Tridiagonal Solvers for ADI methods and Fluid Simulation

Efficient Tridiagonal Solvers for ADI methods and Fluid Simulation Efficient Tridiagonal Solvers for ADI methods and Fluid Simulation Nikolai Sakharnykh - NVIDIA San Jose Convention Center, San Jose, CA September 21, 2010 Introduction Tridiagonal solvers very popular

More information

Grade 5: Concepts and Procedures Target A & B: Operations and Algebraic Thinking

Grade 5: Concepts and Procedures Target A & B: Operations and Algebraic Thinking Grade 5: Concepts and Procedures Target A & B: Operations and Algebraic Thinking Write numerical expressions having one set of parentheses, brackets, or braces. Graph whole number ordered pairs from two

More information

LINPACK Benchmark. on the Fujitsu AP The LINPACK Benchmark. Assumptions. A popular benchmark for floating-point performance. Richard P.

LINPACK Benchmark. on the Fujitsu AP The LINPACK Benchmark. Assumptions. A popular benchmark for floating-point performance. Richard P. 1 2 The LINPACK Benchmark on the Fujitsu AP 1000 Richard P. Brent Computer Sciences Laboratory The LINPACK Benchmark A popular benchmark for floating-point performance. Involves the solution of a nonsingular

More information

The Basic Polynomial Algebra Subprograms

The Basic Polynomial Algebra Subprograms The Basic Polynomial Algebra Subprograms Changbo Chen 1, Svyatoslav Covanov 2, Farnam Mansouri 2, Marc Moreno Maza 2, Ning Xie 2, and Yuzhen Xie 2 1 Chongqing Key Laboratory of Automated Reasoning and

More information

Quick-Sort. Quick-Sort 1

Quick-Sort. Quick-Sort 1 Quick-Sort 7 4 9 6 2 2 4 6 7 9 4 2 2 4 7 9 7 9 2 2 9 9 Quick-Sort 1 Outline and Reading Quick-sort ( 4.3) Algorithm Partition step Quick-sort tree Execution example Analysis of quick-sort (4.3.1) In-place

More information

Intro to Singular Math 676 (Computational Algebraic Geometry) Dan Bates, CSU, Spring 2009

Intro to Singular Math 676 (Computational Algebraic Geometry) Dan Bates, CSU, Spring 2009 Intro to Singular Math 676 (Computational Algebraic Geometry) Dan Bates, CSU, Spring 2009 The point of this brief document is to get you computing in Singular quickly. For more advanced topics, you should

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

An Introduction to Open-Source Mathematics Software

An Introduction to Open-Source Mathematics Software 1 An Introduction to Open-Source Mathematics Software (Specifically: GAP,, Macaulay2 and Sage) Jason B. Hill Slow Pitch Colloquium University of Colorado March 17, 2010 2 Outline 1 Introduction 2 GAP -

More information

Lecture 2 Algorithms with numbers

Lecture 2 Algorithms with numbers Advanced Algorithms Floriano Zini Free University of Bozen-Bolzano Faculty of Computer Science Academic Year 2013-2014 Lecture 2 Algorithms with numbers 1 RSA Algorithm Why does RSA work? RSA is based

More information

Sorting Goodrich, Tamassia Sorting 1

Sorting Goodrich, Tamassia Sorting 1 Sorting Put array A of n numbers in increasing order. A core algorithm with many applications. Simple algorithms are O(n 2 ). Optimal algorithms are O(n log n). We will see O(n) for restricted input in

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Database Technology. Topic 7: Data Structures for Databases. Olaf Hartig.

Database Technology. Topic 7: Data Structures for Databases. Olaf Hartig. Topic 7: Data Structures for Databases Olaf Hartig olaf.hartig@liu.se Database System 2 Storage Hierarchy Traditional Storage Hierarchy CPU Cache memory Main memory Primary storage Disk Tape Secondary

More information

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48 Algorithm Analysis (Algorithm Analysis ) Data Structures and Programming Spring 2018 1 / 48 What is an Algorithm? An algorithm is a clearly specified set of instructions to be followed to solve a problem

More information

Outline. Parallel Algorithms for Linear Algebra. Number of Processors and Problem Size. Speedup and Efficiency

Outline. Parallel Algorithms for Linear Algebra. Number of Processors and Problem Size. Speedup and Efficiency 1 2 Parallel Algorithms for Linear Algebra Richard P. Brent Computer Sciences Laboratory Australian National University Outline Basic concepts Parallel architectures Practical design issues Programming

More information

Physical Disk Structure. Physical Data Organization and Indexing. Pages and Blocks. Access Path. I/O Time to Access a Page. Disks.

Physical Disk Structure. Physical Data Organization and Indexing. Pages and Blocks. Access Path. I/O Time to Access a Page. Disks. Physical Disk Structure Physical Data Organization and Indexing Chapter 11 1 4 Access Path Refers to the algorithm + data structure (e.g., an index) used for retrieving and storing data in a table The

More information

On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators

On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators On Level Scheduling for Incomplete LU Factorization Preconditioners on Accelerators Karl Rupp, Barry Smith rupp@mcs.anl.gov Mathematics and Computer Science Division Argonne National Laboratory FEMTEC

More information

COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05

COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05 COURSE: DATA STRUCTURES USING C & C++ CODE: 05BMCAR17161 CREDITS: 05 Unit 1 : LINEAR DATA STRUCTURES Introduction - Abstract Data Types (ADT), Arrays and its representation Structures, Stack, Queue, Circular

More information

Polynomial Functions Graphing Investigation Unit 3 Part B Day 1. Graph 1: y = (x 1) Graph 2: y = (x 1)(x + 2) Graph 3: y =(x 1)(x + 2)(x 3)

Polynomial Functions Graphing Investigation Unit 3 Part B Day 1. Graph 1: y = (x 1) Graph 2: y = (x 1)(x + 2) Graph 3: y =(x 1)(x + 2)(x 3) Part I: Polynomial Functions when a = 1 Directions: Polynomial Functions Graphing Investigation Unit 3 Part B Day 1 1. For each set of factors, graph the zeros first, then use your calculator to determine

More information

( 3) ( 4 ) 1. Exponents and Radicals ( ) ( xy) 1. MATH 102 College Algebra. still holds when m = n, we are led to the result

( 3) ( 4 ) 1. Exponents and Radicals ( ) ( xy) 1. MATH 102 College Algebra. still holds when m = n, we are led to the result Exponents and Radicals ZERO & NEGATIVE EXPONENTS If we assume that the relation still holds when m = n, we are led to the result m m a m n 0 a = a = a. Consequently, = 1, a 0 n n a a a 0 = 1, a 0. Then

More information

My 2 hours today: 1. Efficient arithmetic in finite fields minute break 3. Elliptic curves. My 2 hours tomorrow:

My 2 hours today: 1. Efficient arithmetic in finite fields minute break 3. Elliptic curves. My 2 hours tomorrow: My 2 hours today: 1. Efficient arithmetic in finite fields 2. 10-minute break 3. Elliptic curves My 2 hours tomorrow: 4. Efficient arithmetic on elliptic curves 5. 10-minute break 6. Choosing curves Efficient

More information

DISCRETE MATHEMATICS

DISCRETE MATHEMATICS DISCRETE MATHEMATICS WITH APPLICATIONS THIRD EDITION SUSANNA S. EPP DePaul University THOIVISON * BROOKS/COLE Australia Canada Mexico Singapore Spain United Kingdom United States CONTENTS Chapter 1 The

More information

Introduction to the SageMath software

Introduction to the SageMath software Introduction to the SageMath software (https://www.sagemath.org) slides available at http://www.labri.fr/perso/vdelecro/teaching.html June 1st 2017, Mini-course HSE Moscow by Vincent Delecroix, CNRS researcher

More information

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

Mathematics. Jaehyun Park. CS 97SI Stanford University. June 29, 2015 Mathematics Jaehyun Park CS 97SI Stanford University June 29, 2015 Outline Algebra Number Theory Combinatorics Geometry Algebra 2 Sum of Powers n k=1 k 3 k 2 = 1 n(n + 1)(2n + 1) 6 = ( k ) 2 = ( 1 2 n(n

More information

A Hybrid Recursive Multi-Way Number Partitioning Algorithm

A Hybrid Recursive Multi-Way Number Partitioning Algorithm Proceedings of the Twenty-Second International Joint Conference on Artificial Intelligence A Hybrid Recursive Multi-Way Number Partitioning Algorithm Richard E. Korf Computer Science Department University

More information

The following information is for reviewing the material since Exam 3:

The following information is for reviewing the material since Exam 3: Outcomes List for Math 121 Calculus I Fall 2010-2011 General Information: The purpose of this Outcomes List is to give you a concrete summary of the material you should know, and the skills you should

More information

Example 2: Simplify each of the following. Round your answer to the nearest hundredth. a

Example 2: Simplify each of the following. Round your answer to the nearest hundredth. a Section 5.4 Division with Decimals 1. Dividing by a Whole Number: To divide a decimal number by a whole number Divide as you would if the decimal point was not there. If the decimal number has digits after

More information

ALGEBRA I Summer Packet

ALGEBRA I Summer Packet ALGEBRA I Summer Packet 2018-2019 Name 7 th Grade Math Teacher: Objectives for Algebra I Summer Packet I. Variables and translating (Problems #1 5) Write Algebraic Expressions Writing Algebraic Equations

More information

In-place Super Scalar. Tim Kralj. Samplesort

In-place Super Scalar. Tim Kralj. Samplesort In-place Super Scalar Tim Kralj Samplesort Outline Quicksort Super Scalar Samplesort In-place Super Scalar Samplesort (IPS 4 o) Analysis Results Further work/questions Quicksort Finds pivots in the array

More information

CMPSCI 187: Programming With Data Structures. Lecture 5: Analysis of Algorithms Overview 16 September 2011

CMPSCI 187: Programming With Data Structures. Lecture 5: Analysis of Algorithms Overview 16 September 2011 CMPSCI 187: Programming With Data Structures Lecture 5: Analysis of Algorithms Overview 16 September 2011 Analysis of Algorithms Overview What is Analysis of Algorithms? L&C s Dishwashing Example Being

More information

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May Code No: R21051 R10 SET - 1 II B. Tech I Semester, Supplementary Examinations, May - 2012 DATA STRUCTURES (Com. to CSE, IT, ECC ) Time: 3 hours Max Marks: 75 Answer any FIVE Questions All Questions carry

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

1. For the sieve technique we solve the problem, recursively mathematically precisely accurately 2. We do sorting to, keep elements in random positions keep the algorithm run in linear order keep the algorithm

More information

UNIT 5 QUADRATIC FUNCTIONS Lesson 1: Interpreting Structure in Expressions Instruction

UNIT 5 QUADRATIC FUNCTIONS Lesson 1: Interpreting Structure in Expressions Instruction Prerequisite Skills This lesson requires the use of the following skills: translating verbal expressions to algebraic expressions evaluating expressions following the order of operations adding and subtracting

More information

Final Exam MAT 100 JS 2018

Final Exam MAT 100 JS 2018 Final Exam MAT 100 JS 2018 Miles College T Dabit MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Tell which set or sets the number belongs to: natural

More information

16 Rational Functions Worksheet

16 Rational Functions Worksheet 16 Rational Functions Worksheet Concepts: The Definition of a Rational Function Identifying Rational Functions Finding the Domain of a Rational Function The Big-Little Principle The Graphs of Rational

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala

MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala faisalgrw123@gmail.com Reference MCQ s For MIDTERM EXAMS CS502- Design and Analysis of Algorithms 1. For the sieve technique we solve

More information

Grade K 8 Standards Grade 5

Grade K 8 Standards Grade 5 Grade 5 In grade 5, instructional time should focus on three critical areas: (1) developing fluency with addition and subtraction of fractions, and developing understanding of the multiplication of fractions

More information

Homework 8: Question 1: N and Parity Parity Parity zero one Even Odd Even Odd Even Even Odd Odd Parity ker ker ker ker

Homework 8: Question 1: N and Parity Parity Parity zero one Even Odd Even Odd Even Even Odd Odd Parity ker ker ker ker Homework 8: Question 1: N and Parity Let Ω = {zero, one,, +}. N is an Ω-algebra with the set of natural numbers ø ={0, 1, 2, 3, } as carrier, and with + and defined as usual. Parity is an Ω-algebra with

More information

1. Answer: x or x. Explanation Set up the two equations, then solve each equation. x. Check

1. Answer: x or x. Explanation Set up the two equations, then solve each equation. x. Check Thinkwell s Placement Test 5 Answer Key If you answered 7 or more Test 5 questions correctly, we recommend Thinkwell's Algebra. If you answered fewer than 7 Test 5 questions correctly, we recommend Thinkwell's

More information

The Limits of Sorting Divide-and-Conquer Comparison Sorts II

The Limits of Sorting Divide-and-Conquer Comparison Sorts II The Limits of Sorting Divide-and-Conquer Comparison Sorts II CS 311 Data Structures and Algorithms Lecture Slides Monday, October 12, 2009 Glenn G. Chappell Department of Computer Science University of

More information

Advanced Database Systems

Advanced Database Systems Lecture IV Query Processing Kyumars Sheykh Esmaili Basic Steps in Query Processing 2 Query Optimization Many equivalent execution plans Choosing the best one Based on Heuristics, Cost Will be discussed

More information

CSE332: Data Abstractions Lecture 7: B Trees. James Fogarty Winter 2012

CSE332: Data Abstractions Lecture 7: B Trees. James Fogarty Winter 2012 CSE2: Data Abstractions Lecture 7: B Trees James Fogarty Winter 20 The Dictionary (a.k.a. Map) ADT Data: Set of (key, value) pairs keys must be comparable insert(jfogarty,.) Operations: insert(key,value)

More information

YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM

YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM YOGYAKARTA STATE UNIVERSITY MATHEMATICS AND NATURAL SCIENCES FACULTY MATHEMATICS EDUCATION STUDY PROGRAM TOPIC 1 INTRODUCING SOME MATHEMATICS SOFTWARE (Matlab, Maple and Mathematica) This topic provides

More information

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li

CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms. Lecturer: Shi Li CSE 431/531: Algorithm Analysis and Design (Spring 2018) Greedy Algorithms Lecturer: Shi Li Department of Computer Science and Engineering University at Buffalo Main Goal of Algorithm Design Design fast

More information

Parallel and Distributed Boolean Gröbner Bases Computation in SageMath

Parallel and Distributed Boolean Gröbner Bases Computation in SageMath Parallel and Distributed Boolean Gröbner Bases Computation in SageMath Akira Nagai nagai.akira@lab.ntt.co.jp NTT Secure Platform Laboratories Japan Yosuke Sato ysato@rs.kagu.tus.ac.jp Tokyo University

More information

Chapter 13: Query Processing

Chapter 13: Query Processing Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

More information

Hashing. Manolis Koubarakis. Data Structures and Programming Techniques

Hashing. Manolis Koubarakis. Data Structures and Programming Techniques Hashing Manolis Koubarakis 1 The Symbol Table ADT A symbol table T is an abstract storage that contains table entries that are either empty or are pairs of the form (K, I) where K is a key and I is some

More information

Integer Algorithms and Data Structures

Integer Algorithms and Data Structures Integer Algorithms and Data Structures and why we should care about them Vladimír Čunát Department of Theoretical Computer Science and Mathematical Logic Doctoral Seminar 2010/11 Outline Introduction Motivation

More information

Computer Science Engineering Sample Papers

Computer Science Engineering Sample Papers See fro more Material www.computetech-dovari.blogspot.com Computer Science Engineering Sample Papers 1 The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose

More information

Floating-point numbers. Phys 420/580 Lecture 6

Floating-point numbers. Phys 420/580 Lecture 6 Floating-point numbers Phys 420/580 Lecture 6 Random walk CA Activate a single cell at site i = 0 For all subsequent times steps, let the active site wander to i := i ± 1 with equal probability Random

More information

The M4RI & M4RIE libraries for linear algebra over F 2 and small extensions

The M4RI & M4RIE libraries for linear algebra over F 2 and small extensions The M4RI & M4RIE libraries for linear algebra over F 2 and small extensions Martin R. Albrecht Nancy, March 30, 2011 Outline M4RI Introduction Multiplication Elimination M4RIE Introduction Travolta Tables

More information

Parallel Algorithms for (PRAM) Computers & Some Parallel Algorithms. Reference : Horowitz, Sahni and Rajasekaran, Computer Algorithms

Parallel Algorithms for (PRAM) Computers & Some Parallel Algorithms. Reference : Horowitz, Sahni and Rajasekaran, Computer Algorithms Parallel Algorithms for (PRAM) Computers & Some Parallel Algorithms Reference : Horowitz, Sahni and Rajasekaran, Computer Algorithms Part 2 1 3 Maximum Selection Problem : Given n numbers, x 1, x 2,, x

More information

A. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum.

A. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum. Problem Solving Drill 05: Exponents and Radicals Question No. 1 of 10 Question 1. Simplify: 7u v 4u 3 v 6 Question #01 (A) 11u 5 v 7 (B) 8u 6 v 6 (C) 8u 5 v 7 (D) 8u 3 v 9 To simplify this expression you

More information

Computer Algebra Algorithms for Orthogonal Polynomials and Special Functions

Computer Algebra Algorithms for Orthogonal Polynomials and Special Functions Computer Algebra Algorithms for Orthogonal Polynomials and Special Functions Prof. Dr. Wolfram Koepf Department of Mathematics University of Kassel koepf@mathematik.uni-kassel.de http://www.mathematik.uni-kassel.de/~koepf

More information

3. According to universal addressing, what is the address of vertex d? 4. According to universal addressing, what is the address of vertex f?

3. According to universal addressing, what is the address of vertex d? 4. According to universal addressing, what is the address of vertex f? 1. Prove: A full m-ary tree with i internal vertices contains n = mi + 1 vertices. 2. For a full m-ary tree with n vertices, i internal vertices, and l leaves, prove: (i) i = (n 1)/m and l = [(m 1)n +

More information

Fundamentals. Copyright Cengage Learning. All rights reserved.

Fundamentals. Copyright Cengage Learning. All rights reserved. Fundamentals Copyright Cengage Learning. All rights reserved. 1.4 Rational Expressions Copyright Cengage Learning. All rights reserved. Objectives The Domain of an Algebraic Expression Simplifying Rational

More information

The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information.

The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information. The Building Blocks: Binary Numbers, Boolean Logic, and Gates Chapter 4 Representing Information The Binary Numbering System Boolean Logic and Gates Building Computer Circuits Control Circuits CMPUT Introduction

More information

Parallel Scalar Multiplication of Elliptic Curve Points. CSE 633 George Gunner March 28, 2017 Professor: Dr. Russ Miller

Parallel Scalar Multiplication of Elliptic Curve Points. CSE 633 George Gunner March 28, 2017 Professor: Dr. Russ Miller Parallel Scalar Multiplication of Elliptic Curve Points CSE 633 George Gunner March 28, 2017 Professor: Dr. Russ Miller Motivation Elliptic curves are commonly used in public-key cryptography Digital Signatures

More information

Competition => Collaboration a runtime-centric view of parallel computation

Competition => Collaboration a runtime-centric view of parallel computation Competition => Collaboration a runtime-centric view of parallel computation Simon Kahan skahan@cs.washington.edu Competition Multiple entities in contention for limited, indivisible resources or opportunities

More information

1. Divide by using long division. (8x 3 + 6x 2 + 7) (x + 2)

1. Divide by using long division. (8x 3 + 6x 2 + 7) (x + 2) Bellwork 0-7-4. Divide by using long division. (8x + 6x 2 + 7) (x + 2) Synthetic division is a shorthand method of dividing a polynomial by a linear binomial by using only the coefficients. For synthetic

More information

2005 Academic Challenge

2005 Academic Challenge 2005 Academic Challenge COMPUTER SCIENCE TEST - SECTIONAL Computer Science Test Production Team Sanjay Madria, University of Missouri at Rolla Author/Team Coordinator S. R. Subramanya, University of Missouri

More information

PS2 out today. Lab 2 out today. Lab 1 due today - how was it?

PS2 out today. Lab 2 out today. Lab 1 due today - how was it? 6.830 Lecture 7 9/25/2017 PS2 out today. Lab 2 out today. Lab 1 due today - how was it? Project Teams Due Wednesday Those of you who don't have groups -- send us email, or hand in a sheet with just your

More information

1. How many white tiles will be in Design 5 of the pattern? Explain your reasoning.

1. How many white tiles will be in Design 5 of the pattern? Explain your reasoning. Algebra 2 Semester 1 Review Answer the question for each pattern. 1. How many white tiles will be in Design 5 of the pattern Explain your reasoning. 2. What is another way to represent the expression 3.

More information

Algorithms and Data Structures

Algorithms and Data Structures Charles A. Wuethrich Bauhaus-University Weimar - CogVis/MMC June 22, 2017 1/51 Introduction Matrix based Transitive hull All shortest paths Gaussian elimination Random numbers Interpolation and Approximation

More information

Overview of the ECE Computer Software Curriculum. David O Hallaron Associate Professor of ECE and CS Carnegie Mellon University

Overview of the ECE Computer Software Curriculum. David O Hallaron Associate Professor of ECE and CS Carnegie Mellon University Overview of the ECE Computer Software Curriculum David O Hallaron Associate Professor of ECE and CS Carnegie Mellon University The Fundamental Idea of Abstraction Human beings Applications Software systems

More information

CS 360 Exam 1 Fall 2014 Name. 1. Answer the following questions about each code fragment below. [8 points]

CS 360 Exam 1 Fall 2014 Name. 1. Answer the following questions about each code fragment below. [8 points] CS 360 Exam 1 Fall 2014 Name 1. Answer the following questions about each code fragment below. [8 points] for (v=1; v

More information

Chapter 9 Review. By Charlie and Amy

Chapter 9 Review. By Charlie and Amy Chapter 9 Review By Charlie and Amy 9.1- Inverse and Joint Variation- Explanation There are 3 basic types of variation: direct, indirect, and joint. Direct: y = kx Inverse: y = (k/x) Joint: y=kxz k is

More information

CORE BODY OF KNOWLEDGE MATH GRADE 6

CORE BODY OF KNOWLEDGE MATH GRADE 6 CORE BODY OF KNOWLEDGE MATH GRADE 6 For each of the sections that follow, students may be required to understand, apply, analyze, evaluate or create the particular concepts being taught. Course Description

More information

L20: Putting it together: Tree Search (Ch. 6)!

L20: Putting it together: Tree Search (Ch. 6)! Administrative L20: Putting it together: Tree Search (Ch. 6)! November 29, 2011! Next homework, CUDA, MPI (Ch. 3) and Apps (Ch. 6) - Goal is to prepare you for final - We ll discuss it in class on Thursday

More information

We can use a max-heap to sort data.

We can use a max-heap to sort data. Sorting 7B N log N Sorts 1 Heap Sort We can use a max-heap to sort data. Convert an array to a max-heap. Remove the root from the heap and store it in its proper position in the same array. Repeat until

More information

Analysis of Algorithms. 5-Dec-16

Analysis of Algorithms. 5-Dec-16 Analysis of Algorithms 5-Dec-16 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based on the size of the input (time complexity), and/or developing

More information