![]() | |||||||||||
| |||||||||||
Mosel files for the Mosel-Python comparison blog Description Mosel files for the blog post comparing Mosel and Python. Instructions for running these files:
Source Files By clicking on a file name, a preview is opened at the bottom of this page. Data Files SparseGrouping_adv.mos (!****************************************************** Mosel Example Problems ====================== file SparseGrouping_adv.mos ``````````````````````````` Improved version of model 'SparseGrouping_std.mos'. -- Multiple cases within a loop over a sparse array -- (c) 2019-2025 Fair Isaac Corporation author: S.Heipcke *******************************************************!) model "Sparse Grouping" !S:IMPORT uses "mmsheet","mmsystem" parameters DATA_FILE_PREFIX = "00" end-parameters writeln("#E:IMPORT") writeln("#S:READ") declarations ISet: range C: dynamic array(ISet,ISet,ISet,ISet) of real G: dynamic array(ISet,ISet,ISet,ISet) of integer end-declarations initializations from "mmetc.diskdata:" C as "sparse,skiph," + DATA_FILE_PREFIX + "_H_SparseGrouping_C.csv" end-initializations writeln("#E:READ") writeln("#S:PROC") forall(i,j,k,l in ISet | exists(C(i,j,k,l))) ! Local definition to replace repeated access to same array element with a=C(i,j,k,l) do if a < 100 then G(i,j,k,l) := 1 elif a < 1000 then G(i,j,k,l) := 2 else G(i,j,k,l) := 3 end-if end-do writeln("#E:PROC") writeln("#S:TEST") forall(i,j,k,l in ISet | exists(G(i,j,k,l)) ) do writeln(i, " ", j, " ", k, " ", l, " ", G(i,j,k,l)) end-do writeln("#E:TEST") end-model
| |||||||||||
© Copyright 2025 Fair Isaac Corporation. |