{"id":27,"date":"2012-04-16T14:38:00","date_gmt":"2012-04-16T19:38:00","guid":{"rendered":"http:\/\/charles-oneill.com\/blog\/?p=27"},"modified":"2014-07-31T11:17:05","modified_gmt":"2014-07-31T16:17:05","slug":"fortran-array-reordering-utility-freo","status":"publish","type":"post","link":"https:\/\/charles-oneill.com\/blog\/fortran-array-reordering-utility-freo\/","title":{"rendered":"Fortran Array Reordering Utility (Freo)"},"content":{"rendered":"<p><\/p>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\">Fortran and C order their arrays differently. Fortran is column major; C is row major. There are performance implications to using the wrong order.<\/div>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\"><\/div>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\">What do you do when you inherit a 10k+ line Fortran code written in C order? Regular expressions are not reliable. By-hand conversion takes too long and is fraught with human errors. So, I wrote the freo program in Scheme to flip the indicies of a specified function. Freo transposes Fortran indicies. It correctly converted the entire 12k line code in 54 files without human help in a few seconds.<\/div>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\"><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\">\n<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin-left: auto; margin-right: auto; text-align: center;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><a href=\"http:\/\/charles-oneill.com\/blog\/wp-content\/uploads\/2012\/04\/freo-use.png\" style=\"margin-left: auto; margin-right: auto;\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" height=\"211\" src=\"http:\/\/charles-oneill.com\/blog\/wp-content\/uploads\/2012\/04\/freo-use-300x159.png\" width=\"400\" \/><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><span style=\"font-family: 'Times New Roman';\">Freo Converting Fortran Arrays in 4 files<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/div>\n<div style=\"color: #111111; font-family: Palatino, serif; font-size: 15px; text-align: justify;\">Download exe file at:&nbsp;<a href=\"http:\/\/www.caselab.okstate.edu\/ocharle\/code\/freo\/freo.exe\" style=\"font-variant: small-caps; font-weight: bold;\">freo.exe<\/a>&nbsp;and .scm code at:&nbsp;<a href=\"http:\/\/www.caselab.okstate.edu\/ocharle\/code\/freo\/freo.scm\" style=\"font-variant: small-caps; font-weight: bold;\">freo.scm<\/a>. The code is not pretty and not optimal, but it does exist and does work. The code is compiled to a windows exe with&nbsp;<a href=\"http:\/\/www.call-cc.org\/\" style=\"font-variant: small-caps; font-weight: bold;\">Chicken Scheme<\/a>.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Fortran and C order their arrays differently. Fortran is column major; C is row major. There are performance implications to using the wrong order. What do you do when you inherit a 10k+ line Fortran code written in C order? Regular expressions are not reliable. By-hand conversion takes too long and is fraught with human [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":58,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/posts\/27"}],"collection":[{"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":0,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/media\/58"}],"wp:attachment":[{"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charles-oneill.com\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}