Vectorised Computation
Scientific computing rests on two pillars: vectorised computation and numerical libraries. Modern code avoids explicit element loops.
Vectorisation expresses operations on whole arrays at once. Instead of c[i] = a[i] + b[i], you write .
This is dramatically faster. Python loops are slow; vectorised operations dispatch to compiled C or Fortran code using CPU SIMD parallel instructions.
| Approach | Execution | Readability |
|---|---|---|
| Loop | Slow, element-by-element | Verbose, low-level |
| Vector | Fast, compiled SIMD | Matches math, concise |
Numerical Libraries
Numerical libraries provide tested routines so you never reimplement fundamentals. They handle stability and pivoting correctly.
| Library Type | Core Purpose |
|---|---|
| Array Library | NumPy-style multidimensional data |
| Linear Algebra | BLAS/LAPACK solvers and transforms |
Common Pitfall: Writing explicit element-by-element loops or reimplementing standard solvers. Always prefer robust library routines over reinventing the wheel.