Home Examples Installation Documentation Contact Help

diag

Specification

Location Author Maintained by
isl/math/matrix3.py Kenny Erleben DIKU

Purpose & Params

Converts an 3 real values to a 3 by 3 diagonal matrix.

Example

    a, b, c = 1,2,3
    np.diag(np.array([a,b,c]))

output:

   array([[1, 0, 0],
          [0, 2, 0],
          [0, 0, 3]])