(!****************************************************** Mosel Python Example Problems ============================= file invert_matrix.mos `````````````````````` Invert a Mosel matrix in Python using NumPy. (c) 2018 Fair Isaac Corporation author: J.Müller *******************************************************!) model 'invert_matrix' options noimplicit uses "python3" ! Input data declarations I, J: range A, A_inverse: array(I, J) of real end-declarations procedure show_matrix(B: array(I: range, J: range) of real) forall (i in I) do forall (j in J) do write(B(i, j), ' ') end-do writeln end-do end-procedure I := 0..2 J := 0..2 A :: [1,0,3, 0,1,2, 0,0,1] writeln('Matrix A:') show_matrix(A) writeln('Create global Python variables.') initializations to PY_IO_GLOBAL_VAR I J A end-initializations writeln('Run Python script.') pyrun('invert_matrix.py') writeln('Python script finished.') writeln('Get global Python variables.') initializations from PY_IO_GLOBAL_VAR A_inverse end-initializations writeln('Matrix A_inverse:') show_matrix(A_inverse) end-model