% Created 2011-05-30 Mon 16:58
\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float,caption,array,multirow}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage[english]{babel} \usepackage{ae,aecompl}
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
\usepackage{listings}
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
\providecommand{\alert}[1]{\textbf{#1}}

\title{}
\author{FOSSEE}
\date{}

\usetheme{Antibes}\usecolortheme{lily}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}











\begin{frame}

\begin{center}
\vspace{12pt}
\textcolor{blue}{\huge Getting started with Arrays}
\end{center}
\vspace{18pt}
\begin{center}
\vspace{10pt}
\includegraphics[scale=0.95]{../images/fossee-logo.png}\\
\vspace{5pt}
\scriptsize Developed by FOSSEE Team, IIT-Bombay. \\ 
\scriptsize Funded by National Mission on Education through ICT\\
\scriptsize  MHRD,Govt. of India\\
\includegraphics[scale=0.30]{../images/iitb-logo.png}\\
\end{center}
\end{frame}
\begin{frame}
\frametitle{Objectives}
\label{sec-2}

  At the end of this tutorial, you will be able to,
   

\begin{itemize}
\item Access and change individual elements of arrays, both one
    dimensional and multi-dimensional.
\item Access and change rows and columns of arrays.
\item Access and change other chunks from an array, using slicing
    and striding.
\item Read images into arrays and perform processing on them, using
    simple array manipulations.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Pre-requisite}
\label{sec-3}


Spoken tutorial on -
\begin{itemize}
\item Getting started with Arrays.
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Sample Arrays}
\label{sec-4}
\lstset{language=Python}
\begin{lstlisting}
In []: A = array([12, 23, 34, 45, 56])

In []: C = array([[11, 12, 13, 14, 15],
                  [21, 22, 23, 24, 25],
                  [31, 32, 33, 34, 35],
                  [41, 42, 43, 44, 45],
                  [51, 52, 53, 54, 55]])
\end{lstlisting}
\end{frame}
\begin{frame}
\frametitle{Exercise 1}
\label{sec-5}

  Change the last column of \verb~C~ to zeroes. 
\end{frame}
\begin{frame}
\frametitle{Exercise 2}
\label{sec-6}

  Change \verb~A~ to \verb~[11, 12, 13, 14, 15]~. 
\end{frame}
\begin{frame}
\frametitle{squares.png}
\label{sec-7}

    \begin{center}
      \includegraphics[scale=0.6]{squares}    
    \end{center}
\end{frame}
\begin{frame}
\frametitle{Exercise 3}
\label{sec-8}


\begin{itemize}
\item obtain \verb~[22, 23]~ from \verb~C~.
\item obtain \verb~[11, 21, 31, 41]~ from \verb~C~.
\item obtain \verb~[21, 31, 41, 0]~.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Exercise 4}
\label{sec-9}

  Obtain \verb~[[23, 24], [33, -34]]~ from \verb~C~
\end{frame}
\begin{frame}
\frametitle{Exercise 5}
\label{sec-10}

  Obtain the square in the center of the image
\end{frame}
\begin{frame}[fragile]
\frametitle{Exercise 6}
\label{sec-11}

  Obtain the following
\lstset{language=Python}
\begin{lstlisting}
[[12, 0], [42, 0]]
[[12, 13, 14], [0, 0, 0]]
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Solution 6}
\label{sec-12}

\lstset{language=Python}
\begin{lstlisting}
In []: C[::3, 1::3]
In []: C[::4, 1:4]
\end{lstlisting}
\end{frame}
\begin{frame}
\frametitle{Summary}
\label{sec-13}

  In this tutorial, we have learnt to, 
 

\begin{itemize}
\item Manipulate single \& multi dimensional arrays.
\item Access and change individual elements by using their index numbers.
\item Access and change rows and columns of arrays by specifying the row 
    and column numbers.
\item Slice and stride on arrays.
\item Read images into arrays and manipulate them.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Evaluation}
\label{sec-14}


\begin{enumerate}
\item Given the array,\\ A = array([12, 15, 18, 21]),\\ How do we access the element ``18''?
\vspace{2pt}
\item Given the array,\\ 
B = array([[10, 11, 12, 13],\\
\hspace{1.64cm}  
           [20, 21, 22, 23],\\
\hspace{1.64cm}           
           [30, 31, 32, 33],\\
\hspace{1.64cm}           
           [40, 41, 42, 43]])\\
Obtain the elements, ``[[21, 22], [31, 32]].''
\vspace{2pt}         
\item Given the array, \\
 
     C = array([[10, 11, 12, 13],\\
\hspace{1.64cm}     
                [20, 21, 22, 23]])\\

     Change the array to, \\
   
    C = array([[10, 11, 10, 11],\\
\hspace{1.64cm}    
               [20, 21, 20, 21]])
\end{enumerate}
\end{frame}
\begin{frame}
\frametitle{Solutions}
\label{sec-15}


\begin{enumerate}
\item A[ 2 ]
\vspace{12pt}
\item B[1:3, 1:3]
\vspace{12pt}
\item B[:2, 2:] = B[:2, :2]
\end{enumerate}
\end{frame}
\begin{frame}

  \begin{block}{}
  \begin{center}
  \textcolor{blue}{\Large THANK YOU!} 
  \end{center}
  \end{block}
\begin{block}{}
  \begin{center}
    For more Information, visit our website\\
    \url{http://fossee.in/}
  \end{center}  
  \end{block}
\end{frame}

\end{document}