Towards Mechanical Derivation of Krylov Solver Libraries

Size: px
Start display at page:

Download "Towards Mechanical Derivation of Krylov Solver Libraries"

Transcription

1 Towards Mechanical Derivation of Krylov Solver Libraries Victor Eijkhout Texas Advanced Computing Center with Paolo Bientinesi and Robert van de Geijn support: National Science Foundation award # /04/05

2 Overview Problem statement Derivation of Krylov methods in FLAME Outlook for mechanical systems 20yr ICL 2010/04/05 2

3 Problem statement Krylov solvers are Hard to derive Hard to code We aim for (in order of increasing ambition) Easy experimentation Formal treatment of algorithm derivation Mechanical system for library generation Automatic reasoning about performance 20yr ICL 2010/04/05 3

4 The view from 30k feet up Algorithm implementations are an overspecification. Separation of concerns: what to compute from how to compute Mechanical generation of algorithm code from a database of algorithm properties 20yr ICL 2010/04/05 4

5 Block formulation of Krylov methods 20yr ICL 2010/04/05 5

6 Introducing one tool Updating equation: x i+1 = x i + p i δ i can be written as X (J I ) = PD using J = so J I = 1 1, writing sequence equations in block form 20yr ICL 2010/04/05 6

7 Coupled recurrences Krylov methods r i+1 = r i + Ap i δ i, p i+1 = r i+1 j i p j u ji (where p i search direction and r i residual in iteration i) On block form: APD = R(I J), P(I + U) = R Coefficients in D and U will follow from orthogonality relations 20yr ICL 2010/04/05 7

8 Idea vs execution Abstract description of iterative method: APD = R(I J), P(I +U) = R (and PD = X (I J)) Basic form of R and P update equation is given Coefficients follow: Stationary Iteration: U 0, D constant CG: R t R = Ω diagonal et cetera Actual computation of D and U is tedious (especially for BiCGstab, QMR with look-ahead) Can we leave that last step to a system? 20yr ICL 2010/04/05 8

9 Krylov methods in Flame 20yr ICL 2010/04/05 9

10 FLAME Formal Linear Algebra Methods Environment System for formal derivation of linear algebra algorithms Predicate driven: predicates on input and output lead to proved correctness of algorithm Main tool: loop with invariant predicate and termination condition (this disqualifies certain algorithms from Flame treatment) Resulting worksheets can (almost) be directly translated into code 20yr ICL 2010/04/05 10

11 Interpretation A Flame worksheet facilitates the derivation of an algorithm: predicates describing the result are needed; derivation of the details is mechanical 20yr ICL 2010/04/05 11

12 Step 1: description of the problem Description of the sequences in block form: X (I J) = PD, APD = R(I J), P(I + U) = R, R t R = Ω (diagonal), x 1, r 1 given (underline means last column omitted) Extra equation: P t AP = (I + U) t R t R(I J)D 1 = (I + U) t Ω(I J)D 1 so P t AP lower triangular 20yr ICL 2010/04/05 12

13 Interpretation Finding the problem description is the one step in the story that requires inspiration. 20yr ICL 2010/04/05 13

14 Step 2: Partitioned Matrix Expression I ` ` TL J TL 0 0 B APL D L Ap M d M AP R D R = RL r M R er t C 1 0 A, 0 e 0 I BR J BR 0 1 I ` TL + U TL u TM u TR B PL p M P 0 1 u MR >< 0 0 I BR + U 0 BR R t L rm t C A ` 0 0 B C R L r M R R 0 0 A, RR t PL t B AP L PL t Ap M PL t AP R 0 p >: M t AP L pm t Ap M pm t AP C B C R A 0 A, PR t AP L PR t Ap M PR t AP R C A = ` R L r M R R, 20yr ICL 2010/04/05 14

15 Interpretation Matrix partitioning is trivial 20yr ICL 2010/04/05 15

16 Step 3: Choice of invariant The PME is a description of the finished result, we choose a subset of the equations (the invariant ) and keep this subset satisfied as the partition progresses through the matrix r 1 given ( ITL J TL AP L D L = (R L, r M ) e t r ) ( ) ( ) ( ) I TL + U TL u TM RL r M = PL p M ( 0 1 R t L R L RL tr ) ( ) ( M 0 P t rm t R L rm t r = L AP L PL tap M M 0 pm t AP L pm t Ap M ) ( 0 = ) 20yr ICL 2010/04/05 16

17 Interpretation There are only finitely many invariants. Some may lead to interesting algorithms, some can be uncomputable. 20yr ICL 2010/04/05 17

18 Step 4: Initialization and loop guard Initial condition: A given, first column of R is given, other matrices are empty or indeterminate. The L block is null, so the invariant holds trivially for at most one column. Loop guard: the size of the R block is null, so the invariant holds for the whole of the computed result. 20yr ICL 2010/04/05 18

19 Step 5: Partition and repartition At the start of the loop body: ( RL r M R R ) ( R0 r 1 r 2 R 3 ) At the end of the loop body: ( R0 r 1 r 2 R 3 ) ( RL r M R R ) In between: steps to make the predicate hold after this shift of the partition boundaries 20yr ICL 2010/04/05 19

20 Step 6: the before equations Use ( R L r M R R ) ( R0 r 1 r 2 R 3 ) in the invariant: ( ) ( ) J 00 AP 0 D 0 = R 0 r 1 j10 t ( ) ( ) I + U 00 u ( 01 P 0 p 1 = 0 1 P before : ( ) ( ) R t ( ) 0 0 R r1 t 0 r 1 =, ( 0 P t 0 AP 0 P0 t Ap ) ( ) 1 0 p1 tap 0 p1 tap =. 1 R 0 r 1 ), 20yr ICL 2010/04/05 20

21 Step 7: the after equations Use ( R 0 r 1 r 2 R 3 ) ( RL r M R R ) : 8!! D 0 0 J 00 0 A P 0 p 1 = R 0 r 1 δ 1 j t + r I + U 00 u 01 u 02 P 0 p 1 p υ 12 C A = R 0 r 1 r 2, >< P after : R t r1 t C A R 0 r 1 r 2 = 0 0 C A, r2 t 0 0 P0 t B AP 0 P0 t Ap 1 P0 T Ap p1 >: t AP 0 p1 t Ap 1 p1 T Ap C 2 A = 0 C A. p2 t AP 0 p2 t Ap 1 p2 T Ap 2, 20yr ICL 2010/04/05 21

22 Step 8: predicate on the update Comparing the before and after predicates yields P after = P before (δ 1 Ap 1 = r 1 r 2 ) (P 0 u 02 + υ 12 p 1 + p 2 = r 2 ) (R t 0r 2 = 0) (r t 1r 2 = 0)) (P t 0Ap 2 = 0) (p T 1 Ap 2 = 0). 20yr ICL 2010/04/05 22

23 Interpretation Deriving the predicate on the update from the invariant is purely mechanical. 20yr ICL 2010/04/05 23

24 Remaining question How do we derive a, provably correct, algorithm for constructing r 2, p 2, δ 1, u 2, that makes P after satisfied 20yr ICL 2010/04/05 24

25 Hoare triples Hoare triple: {Q}S{R} with Q precondition predicate R postcondition predicate S statement(s) is true if, given Q, the statement S makes R true. Example: {χ = η}χ := χ + 1{χ = η + 1} is true. 20yr ICL 2010/04/05 25

26 Weakest preconditions Let (S, R) be the weakest precondition. Define ( x := exp, R) as R with all instances of x replaced by the expression exp. Then { ( x := exp, R)} x := exp {R} For example, { ( x := x + 1, x = y + 4)} x := x + 1 {x = y + 4} and ( x := x + 1, x = y + 4) = {(x + 1) = y + 4} = {x = y + 3}. 20yr ICL 2010/04/05 26

27 Road map for derivation of the update {P before } {Q 0 = ( δ 1 := exp 0, Q 1 )} S 0 : δ 1 = exp 0 {Q 1 = ( r 2 := exp 1, Q 2 )} S 1 : r 2 := exp 1 {Q 2 = ( u 02 := exp 2, Q 3 )} S 2 : u 02 := exp 2 {Q 3 = ( υ 12 := exp 3, Q 4 )} S 3 : υ 12 := exp 3 {Q 4 = ( p 2 := exp 4, P after )} S 4 : p 2 := exp 4 P after = P before (δ 1 Ap 1 = r 1 r 2 ) (P 0 u 02 + υ 12 p 1 + p 2 = r 2 ) (R0 t r 2 = 0) (r1 tr 2 = 0) (r2 tr 2 = ω 2 ) (P0 tap 2 = 0 (p1 tap 2 = 0) 20yr ICL 2010/04/05 27

28 Start at the end: compute p 2 Final triple and so {Q 4 = ( p 2 := exp 4, P after )} S 4 : p 2 := exp 4 {P after } Q 4 = ( p 2 := exp 4, P after ) = {P before (δ 1 Ap 1 = r 1 r 2 ) (P 0 u 02 + υ 12 p 1 + exp 4 = r 2 ) (R0 tr 2 = 0) (r1 tr 2 = 0) (P0 taexp 4 = 0) (p1 taexp 4 = 0)} exp 4 = r 2 P 0 u 02 υ 12 p 1 20yr ICL 2010/04/05 28

29 Substituting exp 4 = r 2 P 0 u 02 υ 12 p 1 : Q 4 = {P before (δ 1 Ap 1 = r 1 r 2 ) (R0 tr 2 = 0) (r1 tr 2 = 0)) (P0 tar 2 P0 tap 0u 02 = 0) (p1 tar 2 p1 tap 0u 02 υ 12 p1 tap 1 = 0)} Similarly, we can determine υ 12 := exp 3 = (p t 1 Ar 2 p t 1 AP 0u 02 )/p t 1 Ap 1, u 02 := exp 2 = (P t 0 AP 0) 1 P t 0 Ar 2 r 2 := exp 1 = r 1 δ 1 Ap 1 δ 1 := exp 0 = r t 1 r 1/r t 1 Ap 1 20yr ICL 2010/04/05 29

30 Conclusion Krylov method derivation can be made systematic, and can almost be done by a mechanical system: Human decides on the PME and invariant System derives the worksheet, in particular the update Degrees of freedom can be explored by search strategies The algorithm is proved correct by derivation; translation to code can be fully automated Research question: can all Krylov methods be derived this way? Will interesting new variants arise? Can we use Flame for other predicates, e.g. relating to performance? 20yr ICL 2010/04/05 30

31 As a famous Dutchman has said The only effective way to raise the confidence level of a program significantly is to give a convincing proof of its correctness. But one should not first make the program and then prove its correctness, because then the requirement of providing the proof would only increase the poor programmer s burden. On the contrary: the programmer should let correctness proof and program grow hand in hand. E.W. Dijkstra 20yr ICL 2010/04/05 31

Towards Mechanical Derivation of Krylov Solver Libraries (submitted to ICCS 2010)

Towards Mechanical Derivation of Krylov Solver Libraries (submitted to ICCS 2010) TACC Technical Report TR-10-01 Towards of Krylov Solver Libraries submitted to ICCS 2010 Victor Eijkhout, Paolo Bientinesi, and Robert van de Geijn This technical report is a preprint of a paper intended

More information

Proof-Driven Derivation of Krylov Solver Libraries

Proof-Driven Derivation of Krylov Solver Libraries TACC Technical Report TR-10-02 Proof-Driven Derivation of Krylov Solver Libraries Victor Eijkhout, Paolo Bientinesi, and Robert van de Geijn This technical report is a preprint of a paper intended for

More information

Systematic Generation of Algorithms for Iterative Methods

Systematic Generation of Algorithms for Iterative Methods Rheinisch-Westfälische Technische Hochschule Aachen Aachen Institute for Advanced Study in Computational Engineering Science Systematic Generation of Algorithms for Iterative Methods Henrik Barthels, B.Sc.

More information

Incomplete Factorizations in the FLAME Framework

Incomplete Factorizations in the FLAME Framework TACC Technical Report TR-10-04 Incomplete Factorizations in the FLAME Framework Victor Eijkhout, Paolo Bientinesi Robert van de Geijn September 3, 2010 This technical report is a preprint of a paper intended

More information

Program verification. 18 October 2017

Program verification. 18 October 2017 Program verification 18 October 2017 Example revisited // assume(n>2); void partition(int a[], int n) { int pivot = a[0]; int lo = 1, hi = n-1; while (lo

More information

Finite-choice algorithm optimization in Conjugate Gradients

Finite-choice algorithm optimization in Conjugate Gradients Finite-choice algorithm optimization in Conjugate Gradients Jack Dongarra and Victor Eijkhout January 2003 Abstract We present computational aspects of mathematically equivalent implementations of the

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen Assertions and Preconditions Assertions are used by programmers to verify run-time execution An assertion is a

More information

Deriving Dense Linear Algebra Libraries

Deriving Dense Linear Algebra Libraries Under consideration for publication in Formal Aspects of Computing Deriving Dense Linear Algebra Libraries Paolo Bientinesi, John Gunnels 2, Margaret Myers 3, Enrique Quintana-Ortí 4, Tyler Rhodes 3, Robert

More information

AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 23: GMRES and Other Krylov Subspace Methods; Preconditioning

AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 23: GMRES and Other Krylov Subspace Methods; Preconditioning AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 23: GMRES and Other Krylov Subspace Methods; Preconditioning Xiangmin Jiao SUNY Stony Brook Xiangmin Jiao Numerical Analysis I 1 / 18 Outline

More information

The Science of Programming Matrix Computations

The Science of Programming Matrix Computations The Science of Programming Matrix Computations The Science of Programming Matrix Computations Robert A van de Geijn The University of Texas at Austin Enrique S Quintana-Ortí Universidad Jaume I Copyright

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

Formal Reasoning CSE 331. Lecture 2 Formal Reasoning. Announcements. Formalization and Reasoning. Software Design and Implementation

Formal Reasoning CSE 331. Lecture 2 Formal Reasoning. Announcements. Formalization and Reasoning. Software Design and Implementation CSE 331 Software Design and Implementation Lecture 2 Formal Reasoning Announcements Homework 0 due Friday at 5 PM Heads up: no late days for this one! Homework 1 due Wednesday at 11 PM Using program logic

More information

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Hoare Logic: Part II

Hoare Logic: Part II Hoare Logic: Part II COMP2600 Formal Methods for Software Engineering Jinbo Huang Australian National University COMP 2600 Hoare Logic II 1 Factorial {n 0} fact := 1; i := n; while (i >0) do fact := fact

More information

Computational Linear Algebra

Computational Linear Algebra Computational Linear Algebra PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering / BGU Scientific Computing in Computer Science / INF Winter Term 2018/19 Part 4: Iterative Methods PD

More information

Floyd-Hoare Style Program Verification

Floyd-Hoare Style Program Verification Floyd-Hoare Style Program Verification Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 9 Feb 2017 Outline of this talk 1 Overview 2 Hoare Triples 3

More information

Notes on LU Factorization

Notes on LU Factorization Notes on LU Factorization Robert A van de Geijn Department of Computer Science The University of Texas Austin, TX 78712 rvdg@csutexasedu October 11, 2014 The LU factorization is also known as the LU decomposition

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

More information

arxiv: v1 [cs.ms] 11 Oct 2017

arxiv: v1 [cs.ms] 11 Oct 2017 Deriving Correct High-Performance Algorithms FLAME Working Note #86 arxiv:1710.04286v1 [cs.ms] Oct 2017 Devangi N. Parikh Margaret E. Myers Robert A. van de Geijn The University of Texas at Austin Austin,

More information

Computational Linear Algebra

Computational Linear Algebra Computational Linear Algebra PD Dr. rer. nat. habil. Ralf Peter Mundani Computation in Engineering / BGU Scientific Computing in Computer Science / INF Winter Term 2017/18 Part 3: Iterative Methods PD

More information

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and shows how a program can sometimes be systematically constructed

More information

Stabilization and Acceleration of Algebraic Multigrid Method

Stabilization and Acceleration of Algebraic Multigrid Method Stabilization and Acceleration of Algebraic Multigrid Method Recursive Projection Algorithm A. Jemcov J.P. Maruszewski Fluent Inc. October 24, 2006 Outline 1 Need for Algorithm Stabilization and Acceleration

More information

FEM and sparse linear system solving

FEM and sparse linear system solving FEM & sparse linear system solving, Lecture 9, Nov 19, 2017 1/36 Lecture 9, Nov 17, 2017: Krylov space methods http://people.inf.ethz.ch/arbenz/fem17 Peter Arbenz Computer Science Department, ETH Zürich

More information

Programming Languages and Compilers (CS 421)

Programming Languages and Compilers (CS 421) Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram Adve, Gul

More information

Chapter 3 - From Gaussian Elimination to LU Factorization

Chapter 3 - From Gaussian Elimination to LU Factorization Chapter 3 - From Gaussian Elimination to LU Factorization Maggie Myers Robert A. van de Geijn The University of Texas at Austin Practical Linear Algebra Fall 29 http://z.cs.utexas.edu/wiki/pla.wiki/ 1

More information

Proof Calculus for Partial Correctness

Proof Calculus for Partial Correctness Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September

More information

Verification and Validation

Verification and Validation 2010-2011 Cycle Ingénieur 2 ème année Département Informatique Verification and Validation Part IV : Proof-based Verification (III) Burkhart Wolff Département Informatique Université Paris-Sud / Orsay

More information

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare Axiomatic Semantics Semantics of Programming Languages course Joosep Rõõmusaare 2014 Direct Proofs of Program Correctness Partial correctness properties are properties expressing that if a given program

More information

M.A. Botchev. September 5, 2014

M.A. Botchev. September 5, 2014 Rome-Moscow school of Matrix Methods and Applied Linear Algebra 2014 A short introduction to Krylov subspaces for linear systems, matrix functions and inexact Newton methods. Plan and exercises. M.A. Botchev

More information

Iterative Methods for Linear Systems of Equations

Iterative Methods for Linear Systems of Equations Iterative Methods for Linear Systems of Equations Projection methods (3) ITMAN PhD-course DTU 20-10-08 till 24-10-08 Martin van Gijzen 1 Delft University of Technology Overview day 4 Bi-Lanczos method

More information

Level-3 BLAS on a GPU

Level-3 BLAS on a GPU Level-3 BLAS on a GPU Picking the Low Hanging Fruit Francisco Igual 1 Gregorio Quintana-Ortí 1 Robert A. van de Geijn 2 1 Departamento de Ingeniería y Ciencia de los Computadores. University Jaume I. Castellón

More information

Exercise 1.3 Work out the probabilities that it will be cloudy/rainy the day after tomorrow.

Exercise 1.3 Work out the probabilities that it will be cloudy/rainy the day after tomorrow. 54 Chapter Introduction 9 s Exercise 3 Work out the probabilities that it will be cloudy/rainy the day after tomorrow Exercise 5 Follow the instructions for this problem given on the class wiki For the

More information

Iterative methods for Linear System

Iterative methods for Linear System Iterative methods for Linear System JASS 2009 Student: Rishi Patil Advisor: Prof. Thomas Huckle Outline Basics: Matrices and their properties Eigenvalues, Condition Number Iterative Methods Direct and

More information

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

More information

Chapter 7 Iterative Techniques in Matrix Algebra

Chapter 7 Iterative Techniques in Matrix Algebra Chapter 7 Iterative Techniques in Matrix Algebra Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128B Numerical Analysis Vector Norms Definition

More information

Recycling Bi-Lanczos Algorithms: BiCG, CGS, and BiCGSTAB

Recycling Bi-Lanczos Algorithms: BiCG, CGS, and BiCGSTAB Recycling Bi-Lanczos Algorithms: BiCG, CGS, and BiCGSTAB Kapil Ahuja Thesis submitted to the Faculty of the Virginia Polytechnic Institute and State University in partial fulfillment of the requirements

More information

Verifying Properties of Parallel Programs: An Axiomatic Approach

Verifying Properties of Parallel Programs: An Axiomatic Approach Verifying Properties of Parallel Programs: An Axiomatic Approach By Susan Owicki and David Gries (1976) Nathan Wetzler nwetzler@cs.utexas.edu University of Texas, Austin November 3, 2009 Outline Introduction

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.

More information

arxiv: v2 [math.na] 1 Sep 2016

arxiv: v2 [math.na] 1 Sep 2016 The structure of the polynomials in preconditioned BiCG algorithms and the switching direction of preconditioned systems Shoji Itoh and Masaai Sugihara arxiv:163.175v2 [math.na] 1 Sep 216 Abstract We present

More information

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 2b Andrew Tolmach Portland State University 1994-2017 Semantics Informal vs. Formal Informal semantics Descriptions in English (or other natural language)

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the

More information

Solutions to exercises for the Hoare logic (based on material written by Mark Staples)

Solutions to exercises for the Hoare logic (based on material written by Mark Staples) Solutions to exercises for the Hoare logic (based on material written by Mark Staples) Exercise 1 We are interested in termination, so that means we need to use the terminology of total correctness, i.e.

More information

The amount of work to construct each new guess from the previous one should be a small multiple of the number of nonzeros in A.

The amount of work to construct each new guess from the previous one should be a small multiple of the number of nonzeros in A. AMSC/CMSC 661 Scientific Computing II Spring 2005 Solution of Sparse Linear Systems Part 2: Iterative methods Dianne P. O Leary c 2005 Solving Sparse Linear Systems: Iterative methods The plan: Iterative

More information

AMS526: Numerical Analysis I (Numerical Linear Algebra)

AMS526: Numerical Analysis I (Numerical Linear Algebra) AMS526: Numerical Analysis I (Numerical Linear Algebra) Lecture 23: GMRES and Other Krylov Subspace Methods Xiangmin Jiao SUNY Stony Brook Xiangmin Jiao Numerical Analysis I 1 / 9 Minimizing Residual CG

More information

Iterative Methods and Multigrid

Iterative Methods and Multigrid Iterative Methods and Multigrid Part 3: Preconditioning 2 Eric de Sturler Preconditioning The general idea behind preconditioning is that convergence of some method for the linear system Ax = b can be

More information

Foundations of Computation

Foundations of Computation The Australian National University Semester 2, 2018 Research School of Computer Science Tutorial 6 Dirk Pattinson Foundations of Computation The tutorial contains a number of exercises designed for the

More information

Probabilistic Guarded Commands Mechanized in HOL

Probabilistic Guarded Commands Mechanized in HOL Probabilistic Guarded Commands Mechanized in HOL Joe Hurd joe.hurd@comlab.ox.ac.uk Oxford University Joint work with Annabelle McIver (Macquarie University) and Carroll Morgan (University of New South

More information

Summary of Iterative Methods for Non-symmetric Linear Equations That Are Related to the Conjugate Gradient (CG) Method

Summary of Iterative Methods for Non-symmetric Linear Equations That Are Related to the Conjugate Gradient (CG) Method Summary of Iterative Methods for Non-symmetric Linear Equations That Are Related to the Conjugate Gradient (CG) Method Leslie Foster 11-5-2012 We will discuss the FOM (full orthogonalization method), CG,

More information

Linear Solvers. Andrew Hazel

Linear Solvers. Andrew Hazel Linear Solvers Andrew Hazel Introduction Thus far we have talked about the formulation and discretisation of physical problems...... and stopped when we got to a discrete linear system of equations. Introduction

More information

Key words. conjugate gradients, normwise backward error, incremental norm estimation.

Key words. conjugate gradients, normwise backward error, incremental norm estimation. Proceedings of ALGORITMY 2016 pp. 323 332 ON ERROR ESTIMATION IN THE CONJUGATE GRADIENT METHOD: NORMWISE BACKWARD ERROR PETR TICHÝ Abstract. Using an idea of Duff and Vömel [BIT, 42 (2002), pp. 300 322

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

IDR(s) A family of simple and fast algorithms for solving large nonsymmetric systems of linear equations

IDR(s) A family of simple and fast algorithms for solving large nonsymmetric systems of linear equations IDR(s) A family of simple and fast algorithms for solving large nonsymmetric systems of linear equations Harrachov 2007 Peter Sonneveld en Martin van Gijzen August 24, 2007 1 Delft University of Technology

More information

9.1 Preconditioned Krylov Subspace Methods

9.1 Preconditioned Krylov Subspace Methods Chapter 9 PRECONDITIONING 9.1 Preconditioned Krylov Subspace Methods 9.2 Preconditioned Conjugate Gradient 9.3 Preconditioned Generalized Minimal Residual 9.4 Relaxation Method Preconditioners 9.5 Incomplete

More information

CME342 Parallel Methods in Numerical Analysis. Matrix Computation: Iterative Methods II. Sparse Matrix-vector Multiplication.

CME342 Parallel Methods in Numerical Analysis. Matrix Computation: Iterative Methods II. Sparse Matrix-vector Multiplication. CME342 Parallel Methods in Numerical Analysis Matrix Computation: Iterative Methods II Outline: CG & its parallelization. Sparse Matrix-vector Multiplication. 1 Basic iterative methods: Ax = b r = b Ax

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

Lecture 17 Methods for System of Linear Equations: Part 2. Songting Luo. Department of Mathematics Iowa State University

Lecture 17 Methods for System of Linear Equations: Part 2. Songting Luo. Department of Mathematics Iowa State University Lecture 17 Methods for System of Linear Equations: Part 2 Songting Luo Department of Mathematics Iowa State University MATH 481 Numerical Methods for Differential Equations Songting Luo ( Department of

More information

Program Construction and Reasoning

Program Construction and Reasoning Program Construction and Reasoning Shin-Cheng Mu Institute of Information Science, Academia Sinica, Taiwan 2010 Formosan Summer School on Logic, Language, and Computation June 28 July 9, 2010 1 / 97 Introduction:

More information

Solutions. Problem 1: Suppose a polynomial in n of degree d has the form

Solutions. Problem 1: Suppose a polynomial in n of degree d has the form Assignment 1 1. Problem 3-1 on p. 57 2. Problem 3-2 on p. 58 3. Problem 4-5 on p. 86 4. Problem 6-1 on p. 142 5. Problem 7-4 on p. 162 6. Prove correctness (including halting) of SelectionSort (use loop

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4

More information

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS

LINEAR ALGEBRA 1, 2012-I PARTIAL EXAM 3 SOLUTIONS TO PRACTICE PROBLEMS LINEAR ALGEBRA, -I PARTIAL EXAM SOLUTIONS TO PRACTICE PROBLEMS Problem (a) For each of the two matrices below, (i) determine whether it is diagonalizable, (ii) determine whether it is orthogonally diagonalizable,

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers Axiomatic Semantics Hoare s Correctness Triplets Dijkstra s Predicate Transformers Goal of a program = IO Relation Problem Specification Properties satisfied by the input and expected of the output (usually

More information

Proofs of Correctness: Introduction to Axiomatic Verification

Proofs of Correctness: Introduction to Axiomatic Verification Proofs of Correctness: Introduction to Axiomatic Verification Introduction Weak correctness predicate Assignment statements Sequencing Selection statements Iteration 1 Introduction What is Axiomatic Verification?

More information

Iterative Methods for Sparse Linear Systems

Iterative Methods for Sparse Linear Systems Iterative Methods for Sparse Linear Systems Luca Bergamaschi e-mail: berga@dmsa.unipd.it - http://www.dmsa.unipd.it/ berga Department of Mathematical Methods and Models for Scientific Applications University

More information

Notes on Solving Linear Least-Squares Problems

Notes on Solving Linear Least-Squares Problems Notes on Solving Linear Least-Squares Problems Robert A. van de Geijn The University of Texas at Austin Austin, TX 7871 October 1, 14 NOTE: I have not thoroughly proof-read these notes!!! 1 Motivation

More information

CSE 331 Winter 2018 Homework 1

CSE 331 Winter 2018 Homework 1 Directions: - Due Wednesday, January 10 by 11 pm. - Turn in your work online using gradescope. You should turn in a single pdf file. You can have more than one answer per page, but please try to avoid

More information

Computational Linear Algebra

Computational Linear Algebra Computational Linear Algebra PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering / BGU Scientific Computing in Computer Science / INF Winter Term 2018/19 Part 4: Iterative Methods PD

More information

Variants of BiCGSafe method using shadow three-term recurrence

Variants of BiCGSafe method using shadow three-term recurrence Variants of BiCGSafe method using shadow three-term recurrence Seiji Fujino, Takashi Sekimoto Research Institute for Information Technology, Kyushu University Ryoyu Systems Co. Ltd. (Kyushu University)

More information

Mid-Semester Quiz Second Semester, 2012

Mid-Semester Quiz Second Semester, 2012 THE AUSTRALIAN NATIONAL UNIVERSITY Mid-Semester Quiz Second Semester, 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 1 hour duration Study Period: 10 minutes duration Permitted

More information

Event reconstruction algorithm

Event reconstruction algorithm Chapter 7 Event reconstruction algorithm The existing algorithms for analysis of finite state models of computing systems were developed for the purpose of systems verification [28]. The event reconstruction

More information

CS137 Introduction to Scientific Computing Winter Quarter 2004 Solutions to Homework #3

CS137 Introduction to Scientific Computing Winter Quarter 2004 Solutions to Homework #3 CS137 Introduction to Scientific Computing Winter Quarter 2004 Solutions to Homework #3 Felix Kwok February 27, 2004 Written Problems 1. (Heath E3.10) Let B be an n n matrix, and assume that B is both

More information

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014 Introduction Pedro Cabalar Department of Computer Science University of Corunna, SPAIN cabalar@udc.es 2013/2014 P. Cabalar ( Department Introduction of Computer Science University of Corunna, SPAIN2013/2014

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

6.4 Krylov Subspaces and Conjugate Gradients

6.4 Krylov Subspaces and Conjugate Gradients 6.4 Krylov Subspaces and Conjugate Gradients Our original equation is Ax = b. The preconditioned equation is P Ax = P b. When we write P, we never intend that an inverse will be explicitly computed. P

More information

Iterative Methods for Solving A x = b

Iterative Methods for Solving A x = b Iterative Methods for Solving A x = b A good (free) online source for iterative methods for solving A x = b is given in the description of a set of iterative solvers called templates found at netlib: http

More information

Soundness and Completeness of Axiomatic Semantics

Soundness and Completeness of Axiomatic Semantics #1 Soundness and Completeness of Axiomatic Semantics #2 One-Slide Summary A system of axiomatic semantics is sound if everything we can prove is also true: if ` { A } c { B } then ² { A } c { B } We prove

More information

Contents. Preface... xi. Introduction...

Contents. Preface... xi. Introduction... Contents Preface... xi Introduction... xv Chapter 1. Computer Architectures... 1 1.1. Different types of parallelism... 1 1.1.1. Overlap, concurrency and parallelism... 1 1.1.2. Temporal and spatial parallelism

More information

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

Numerical behavior of inexact linear solvers

Numerical behavior of inexact linear solvers Numerical behavior of inexact linear solvers Miro Rozložník joint results with Zhong-zhi Bai and Pavel Jiránek Institute of Computer Science, Czech Academy of Sciences, Prague, Czech Republic The fourth

More information

SOLVING SPARSE LINEAR SYSTEMS OF EQUATIONS. Chao Yang Computational Research Division Lawrence Berkeley National Laboratory Berkeley, CA, USA

SOLVING SPARSE LINEAR SYSTEMS OF EQUATIONS. Chao Yang Computational Research Division Lawrence Berkeley National Laboratory Berkeley, CA, USA 1 SOLVING SPARSE LINEAR SYSTEMS OF EQUATIONS Chao Yang Computational Research Division Lawrence Berkeley National Laboratory Berkeley, CA, USA 2 OUTLINE Sparse matrix storage format Basic factorization

More information

A parsing technique for TRG languages

A parsing technique for TRG languages A parsing technique for TRG languages Daniele Paolo Scarpazza Politecnico di Milano October 15th, 2004 Daniele Paolo Scarpazza A parsing technique for TRG grammars [1]

More information

Applied Mathematics 205. Unit V: Eigenvalue Problems. Lecturer: Dr. David Knezevic

Applied Mathematics 205. Unit V: Eigenvalue Problems. Lecturer: Dr. David Knezevic Applied Mathematics 205 Unit V: Eigenvalue Problems Lecturer: Dr. David Knezevic Unit V: Eigenvalue Problems Chapter V.4: Krylov Subspace Methods 2 / 51 Krylov Subspace Methods In this chapter we give

More information

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group EXAMINING REFINEMENT: THEORY, TOOLS AND MATHEMATICS Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group PROBLEM Different formalisms do not integrate

More information

A Generalized Eigenmode Algorithm for Reducible Regular Matrices over the Max-Plus Algebra

A Generalized Eigenmode Algorithm for Reducible Regular Matrices over the Max-Plus Algebra International Mathematical Forum, 4, 2009, no. 24, 1157-1171 A Generalized Eigenmode Algorithm for Reducible Regular Matrices over the Max-Plus Algebra Zvi Retchkiman Königsberg Instituto Politécnico Nacional,

More information

On Operator-Valued Bi-Free Distributions

On Operator-Valued Bi-Free Distributions On Operator-Valued Bi-Free Distributions Paul Skoufranis TAMU March 22, 2016 Paul Skoufranis On Operator-Valued Bi-Free Distributions March 22, 2016 1 / 30 Bi-Free with Amalgamation Let B be a unital algebra.

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

Week6. Gaussian Elimination. 6.1 Opening Remarks Solving Linear Systems. View at edx

Week6. Gaussian Elimination. 6.1 Opening Remarks Solving Linear Systems. View at edx Week6 Gaussian Elimination 61 Opening Remarks 611 Solving Linear Systems View at edx 193 Week 6 Gaussian Elimination 194 61 Outline 61 Opening Remarks 193 611 Solving Linear Systems 193 61 Outline 194

More information

Last Time. Inference Rules

Last Time. Inference Rules Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written

More information

Reduced Synchronization Overhead on. December 3, Abstract. The standard formulation of the conjugate gradient algorithm involves

Reduced Synchronization Overhead on. December 3, Abstract. The standard formulation of the conjugate gradient algorithm involves Lapack Working Note 56 Conjugate Gradient Algorithms with Reduced Synchronization Overhead on Distributed Memory Multiprocessors E. F. D'Azevedo y, V.L. Eijkhout z, C. H. Romine y December 3, 1999 Abstract

More information

Algebraic Multigrid as Solvers and as Preconditioner

Algebraic Multigrid as Solvers and as Preconditioner Ò Algebraic Multigrid as Solvers and as Preconditioner Domenico Lahaye domenico.lahaye@cs.kuleuven.ac.be http://www.cs.kuleuven.ac.be/ domenico/ Department of Computer Science Katholieke Universiteit Leuven

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

College of William & Mary Department of Computer Science

College of William & Mary Department of Computer Science Technical Report WM-CS-2009-06 College of William & Mary Department of Computer Science WM-CS-2009-06 Extending the eigcg algorithm to non-symmetric Lanczos for linear systems with multiple right-hand

More information