Outline - PowerPoint PPT Presentation

About This Presentation
Title:

Outline

Description:

lib NAME .a. libblas.a -- BLAS routines. liblapack.a--LAPACK routines ... System libraries (/usr/lib, etc.) automatically included, so -L not necessary ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 13
Provided by: andrewjp5
Category:
Tags: lib | outline

less

Transcript and Presenter's Notes

Title: Outline


1
Outline
  • Announcements
  • Add/drop by Monday
  • HWI on the web
  • Principal Components Analysis (PCA)
  • Linking to libraries

2
PCA
  • Many scientific problems are complicated
  • High-dimensional (lots of interesting parameters)
  • Observations from mulitple instruments/locations
  • PCA is a method for reducing the dimensionality
    of a system by exploiting covariance among
    variables
  • PCA identifies linear combinations (vectors) that
    represent interesting features common to the
    data sets

3
PCA
  • Example Temperature in NW Atlantic

4
PCA
5
PCA
n
  • Matrix of data

Rgn 1 Rgn 2 Rgn 8
C




m
Cov1/(m-1)CTC Cov is n-by-n
6
PCA
  • Let
  • v1, v2, , vN be the eigenvectors of Cov
  • ?1, ? 2, , ? N be the corresponding eigenvalues
  • Assume ?1gt? 2gt gt ? N
  • Then,
  • C v1 is a new time-series representing
  • ?1/(?1 ? 2 ? N ) percent of the total
    variance
  • If youre lucky, v1 v2 will represent a lot of
    the variance and can be used instead of the
    entire system

7
PCA
8
PCA Summary
  • Load m-by-n data matrix C
  • Compute Cov1/(m-1)CTC
  • BLAS Level 3 routine SSYRK computes
  • aAATbv
  • aATAbv
  • Compute eigenvalues and eigenvectors of Cov
  • LAPACK routine SSYEV computes eigenvectors and
    eigenvalues for symmetric matrices

9
Accessing Libraries
  • We could download code for BLAS and LAPACK and
    compile with our code
  • Slow (BLAS and LAPACK are big)
  • Ideally, we would compile BLAS LAPACK once to
    object code (.o) and link
  • Saves compile time, easier to maintain

10
UNIX Libraries
  • Pre-built libraries (commercial or otherwise) are
    stored as archives on UNIX machines
  • libltNAMEgt.a
  • libblas.a -- BLAS routines
  • liblapack.a--LAPACK routines
  • System libraries are in directories like /lib and
    /usr/lib
  • archives are actually collections of object code
    (.o)
  • How do we access routines in libraries?

11
Compiling Linking
cc prog.c -oprog
Transnslation
Link
12
Building with libraries
  • 1) Compile the code you have (use -c)
  • 2) Link your code together and link to the
    libraries you need
  • g77 ltYOUR OBJECTSgt -LltLIBPATHgt -lname
  • -L sets directory where linker will look for
    libraries
  • System libraries (/usr/lib, etc.) automatically
    included, so -L not necessary
  • -lname links to libname.a system libraries (or
    LIBPATH)
Write a Comment
User Comments (0)
About PowerShow.com