equal
deleted
inserted
replaced
148 \end{lstlisting} |
148 \end{lstlisting} |
149 \column{0.35\textwidth} |
149 \column{0.35\textwidth} |
150 \includegraphics[height=0.7in, interpolate=true]{data/broadcast_scalar} |
150 \includegraphics[height=0.7in, interpolate=true]{data/broadcast_scalar} |
151 \end{columns} |
151 \end{columns} |
152 \begin{itemize} |
152 \begin{itemize} |
153 \item Allows functions to take inputs not of the same shape |
153 \item Allows functions to take inputs that are not of the same shape |
154 \item 2 rules - |
154 \item 2 rules - |
155 \begin{enumerate} |
155 \begin{enumerate} |
156 \item 1 is (repeatedly) prepended to shapes of smaller arrays |
156 \item 1 is (repeatedly) prepended to shapes of smaller arrays |
157 \item Size 1 in a dimension changed to Largest size in that dimension |
157 \item Size 1 in a dimension changed to Largest size in that dimension |
158 \end{enumerate} |
158 \end{enumerate} |
175 \end{frame} |
175 \end{frame} |
176 |
176 |
177 \begin{frame}[fragile] |
177 \begin{frame}[fragile] |
178 \frametitle{Copies \& Views} |
178 \frametitle{Copies \& Views} |
179 Try it! |
179 Try it! |
180 \begin{lstlisting} |
180 \vspace{-0.1in} |
181 >>> a = np.array([[1,2,3],[4,5,6]]) |
181 \begin{lstlisting} |
|
182 >>> a = np.arange(1,9); a.shape=3,3 |
182 >>> b = a |
183 >>> b = a |
183 >>> b is a |
184 >>> b is a |
184 >>> b[0,0]=0; print a |
185 >>> b[0,0]=0; print a |
185 >>> c = a.view() |
186 >>> c = a.view() |
186 >>> c is a |
187 >>> c is a |
193 \end{frame} |
194 \end{frame} |
194 |
195 |
195 \begin{frame}[fragile] |
196 \begin{frame}[fragile] |
196 \frametitle{Copies \& Views} |
197 \frametitle{Copies \& Views} |
197 Try it! |
198 Try it! |
198 \begin{lstlisting} |
199 \vspace{-0.1in} |
199 >>> a = np.arange(1,9) |
200 \begin{lstlisting} |
200 >>> a.shape=3,3 |
|
201 >>> b = a[0,1:3] |
201 >>> b = a[0,1:3] |
202 >>> c = a[0::2,0::2] |
202 >>> c = a[0::2,0::2] |
203 >>> a.flags.owndata |
203 >>> a.flags.owndata |
204 >>> b.flags.owndata |
204 >>> b.flags.owndata |
205 >>> b.base |
205 >>> b.base |