From 57eddc97919c2cf1af43a6ebf57441976583f2b9 Mon Sep 17 00:00:00 2001 From: John Stachurski Date: Wed, 26 Jan 2022 12:11:33 +1100 Subject: [PATCH] Added column major order note --- lectures/opt_transport.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lectures/opt_transport.md b/lectures/opt_transport.md index 7a5cb8660..6257c2f1a 100644 --- a/lectures/opt_transport.md +++ b/lectures/opt_transport.md @@ -366,6 +366,17 @@ print("z:", res.x) print("X:", res.x.reshape((m,n), order='F')) ``` +Notice how, in the line `C_vec = C.reshape((m*n, 1), order='F')`, we are +careful to vectorize using the flag `order='F'`. + +This is consistent with converting $C$ into a vector by stacking all of its +columns into a column vector. + +Here `'F'` stands for "Fortran", and we are using Fortran style column-major order. + +(For an alternative approach, using Python's default row-major ordering, see [this + lecture by Alfred + Galichon](https://www.math-econ-code.org/mec-optim-b04).) **Interpreting the warning:**