... | ... | @@ -202,7 +202,7 @@ How much faster is NumPy? Let us run a quick using [benchmark_broadcasting.py](h |
|
|
On a Core i7-6700k... For 1 million numbers, run 100 times... The NumPy code is
|
|
|
a little over 10 times faster than the pure Python code.
|
|
|
|
|
|
| | Time |
|
|
|
| | Time (sec) |
|
|
|
| :--- | ---: |
|
|
|
| Python | 5.1248 |
|
|
|
| NumPy | 0.3168 |
|
... | ... | @@ -220,9 +220,6 @@ There are a few more topics to introduce: |
|
|
|
|
|
# Implementing a Matrix Solver
|
|
|
|
|
|
|
|
|
## Linear Algebra
|
|
|
|
|
|
In CS 417/517 Computational Methods... I require students to [implement a
|
|
|
Matrix Solver... from
|
|
|
scratch](https://www.cs.odu.edu/~tkennedy/cs417/s21/Assts/matrixSolverExercise/).
|
... | ... | @@ -232,6 +229,8 @@ Let us implement a quick NumPy based Matrix solver, for this [Discrete Case |
|
|
Least Squares Approximation
|
|
|
Problem](https://www.cs.odu.edu/~tkennedy/cs417/s21/Public/approximationExample2/).
|
|
|
|
|
|
The code snippets in this section are extracted from [least_squares.py](https://git-community.cs.odu.edu/tkennedy/python-workshop/-/blob/master/NumPy/least_squares.py).
|
|
|
|
|
|
```python
|
|
|
import numpy as np
|
|
|
|
... | ... | |