You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/Optimization.tex
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ \section{Some optimizations you are allowed to use}
47
47
48
48
That being said, there are a few general rules that will prevent your code from accidentally becoming horrendously slow:
49
49
\begin{itemize}
50
-
\item\textbf{Don't reinvent the wheel.} Don't try to write your own matrix multiplication routine, use \texttt{matmul}, or the routines from BLAS (see \nameref{chap:Linearalgebra}).
50
+
\item\textbf{Don't reinvent the wheel.} Don't try to write your own matrix multiplication routine, use \keyword{matmul}, or the routines from BLAS (see \nameref{chap:Linearalgebra}).
51
51
Fortran has many built-in numerical functions that are much faster than anything you'll be able to write---use them! (Google `Fortran intrinsics' to get an overview.)
52
52
\newpage
53
53
\item\textbf{Use array operations.} You can add two arrays by writing
@@ -134,7 +134,7 @@ \section{Scalability; or, the importance of big O}
134
134
\item Solving a system of linear equations is also $\Oh{n^2}$, but the prefactor is much larger than for matrix-vector multiplication.
135
135
\item\Naive\ matrix-matrix multiplication is $\Oh{n^3}$.
136
136
Libraries such as BLAS and \indexentry{LAPACK} are smarter and do it in $\Oh{n^{\log_2(7)}}\approx\Oh{n^{2.807}}$.
137
-
Another reason to avoid writing this yourself.\footnote{The Fortran intrinsic \texttt{matmul} is actually implemented using BLAS.}
137
+
Another reason to avoid writing this yourself.\footnote{The Fortran intrinsic \keyword{matmul} is actually implemented using BLAS.}
138
138
\item Taking the inverse of\ a matrix and calculating the eigenvalues/eigenvectors are both $\Oh{n^3}$.
139
139
However, eigendecomposition has a much larger prefactor and is therefore significantly slower.
140
140
It is logically the most expensive matrix operation, since all operations on a diagonal matrix are $\Oh{n}$.
0 commit comments