AdditionalLecture3-num-lin-alg-software

AdditionalLecture3-num-lin-alg-software - Numerical Linear...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Numerical Linear Algebra Software (based on slides written by Michael Grant) • BLAS, ATLAS • LAPACK • sparse matrices Prof. S. Boyd, EE364b, Stanford University Numerical linear algebra in optimization most memory usage and computation time in optimization methods is spent on numerical linear algebra, e.g. , • constructing sets of linear equations ( e.g. , Newton or KKT systems) – matrix-matrix products, matrix-vector products, . . . • and solving them – factoring, forward and backward substitution, . . . . . . so knowing about numerical linear algebra is a good thing Prof. S. Boyd, EE364b, Stanford University 1 Why not just use Matlab? • Matlab (Octave, . . . ) is OK for prototyping an algorithm • but you’ll need to use a real language ( e.g. , C, C++, Python) when – your problem is very large, or has special structure – speed is critical ( e.g. , real-time) – your algorithm is embedded in a larger system or tool – you want to avoid proprietary software • in any case, the numerical linear algebra in Matlab is done using standard free libraries Prof. S. Boyd, EE364b, Stanford University 2 How to write numerical linear algebra software DON’T! whenever possible, rely on existing, mature software libraries • you can focus on the higher-level algorithm • your code will be more portable, less buggy, and will run faster—sometimes much faster Prof. S. Boyd, EE364b, Stanford University 3 Netlib the grandfather of all numerical linear algebra web sites http://www.netlib.org • maintained by University of Tennessee, Oak Ridge National Laboratory, and colleagues worldwide • most of the code is public domain or freely licensed • much written in FORTRAN 77 (gasp!) Prof. S. Boyd, EE364b, Stanford University 4 Basic Linear Algebra Subroutines (BLAS) written by people who had the foresight to understand the future benefits of a standard suite of “kernel” routines for linear algebra. created and organized in three levels : • Level 1 , 1973-1977: O ( n ) vector operations: addition, scaling, dot products, norms • Level 2 , 1984-1986: O ( n 2 ) matrix-vector operations: matrix-vector products, triangular matrix-vector solves, rank-1 and symmetric rank-2 updates • Level 3 , 1987-1990: O ( n 3 ) matrix-matrix operations: matrix-matrix products, triangular matrix solves, low-rank updates Prof. S. Boyd, EE364b, Stanford University 5 BLAS operations Level 1 addition/scaling αx , αx + y dot products, norms x T y , bardbl x bardbl 2 , bardbl x bardbl 1 Level 2 matrix/vector products αAx + βy , αA T x + βy rank 1 updates A + αxy T , A + αxx T rank 2 updates A + αxy T + αyx T triangular solves αT- 1 x , αT- T x Level 3 matrix/matrix products αAB + βC , αAB T + βC αA T B + βC , αA T B T + βC rank- k updates αAA T + βC , αA T A + βC rank- 2 k updates αA T B + αB T A + βC triangular solves αT- 1 C , αT- T C Prof. S. Boyd, EE364b, Stanford University 6 Level 1 BLAS naming convention BLAS routines have a Fortran-inspired naming convention:...
View Full Document

This note was uploaded on 04/09/2010 for the course EE 364B at Stanford.

Page1 / 28

AdditionalLecture3-num-lin-alg-software - Numerical Linear...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online