Vector Programming¶

The aim of the exercises is

  • to have a program that gives the correct answer
  • which is as fast as possible (and for this we use massively Numpy)

Generally if you have nested for it's a bad sign.

In [1]:
import numpy as np

np.set_printoptions(precision=10, linewidth=150, suppress=True)

Partial Gaussian pivot method¶

The announcement is in the course. We will check on the case which generates rounding errors.

In [ ]:
 

Choleski factorization¶

This is to decompose A into $A = B\, B^T$ with B a lower triangular matrix. This is not possible that if the matrix A is symmetric and positive definite (this is moreover a way of verifying that a matrix is ​​positive definite).

Write Choleski's algorithm that takes A and returns B (to guess the algorithm, try to find the coefficients of B from the coefficients of A on a 4x4 matrix A).

In [ ]:
 

Reminder: no nested for loops but vector and matrix operations (on sub-matrices).

Create a positive definite symmetric matrix and verify that its program works.

In [ ]: