Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation

preprint OA: closed
Full text JSON View at publisher
Full text 11,160 characters · extracted from preprint-html · click to expand
Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Physical Sciences - Article Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation Ruben Dario Guerrero This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8773066/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Recurrence relations are computational primitives across scientific computing, from orthogonal polynomials to molecular integral evaluation. Traditional implementations face a dual expertise barrier: domain scientists lack C++ optimisation skills, whilst software engineers lack domain knowledge. We present RECURSUM, a Python-based domain-specific language automatically generating optimised C++ code for arbitrary recurrence relations. Our LayeredCodegen backend achieves 9.8× speedup over expert hand-written implementations and 1.9× over template metaprogramming for McMurchie-Davidson Hermite coefficients--inverting the conventional hierarchy where manual optimisation defines the ceiling. Three systematic optimisations explain this: zero-copy output parameters (23× bandwidth reduction), guaranteed function inlining, and exact-sized stack buffers (100% vs 27% cache efficiency). Validated across 24 recurrence types spanning quantum chemistry, numerical analysis, and special functions on CPU backends (x86-64, ARM64), RECURSUM demonstrates automated generation can serve as the performance ceiling. The single-source specification architecture enables hardware portability, with GPU/FPGA/TPU backends planned. This paradigm shift democratises high-performance computing by eliminating the expertise barrier whilst systematically exceeding manual optimisation. Physical sciences/Mathematics and computing/Applied mathematics Physical sciences/Mathematics and computing/Computational science Physical sciences/Physics/Quantum physics Physical sciences/Chemistry/Theoretical chemistry/Quantum chemistry Scientific computing Recurrence relations Domain-specific language Automatic code generation Full Text Additional Declarations There is NO Competing Interest. Supplementary Files SIRECURSUMmanuscriptfinalnature.pdf Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8773066","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Physical Sciences - Article","associatedPublications":[],"authors":[{"id":585153216,"identity":"bd5de0e2-d0ae-492f-95dd-07f5b8da7320","order_by":0,"name":"Ruben Dario Guerrero","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA8ElEQVRIiWNgGAWjYFCCBDiL8QGQkAFiA6K1MIOU8pCkhU2CKC3m7enXJD7uuSdn3t6dVs27w46Hgb15mwRDjQ1OLTJn3pRJznhWbCxz5uy227xnknkYeI6VSTAcS8OpRUIiJ02a50BC4gyJXKCWNmYeBokcMwnGhsP4tfw5kFAP0lLM21bPwyD/hpCW9GPSDAcSEiSAWph52w4DbeEhoIXnDbNlz4EEwxk8ZzdLzm07zsPGk1ZskYDPL+zpD2/8OJAgL8Heu/HD27ZqOX72wxtvfMATYsCIQIsFNhCRgEcDAwP7A7zSo2AUjIJRMAoYACCVSllwN5kcAAAAAElFTkSuQmCC","orcid":"https://orcid.org/0000-0003-4523-1788","institution":"NeuroTechNet SAS","correspondingAuthor":true,"prefix":"","firstName":"Ruben","middleName":"Dario","lastName":"Guerrero","suffix":""}],"badges":[],"createdAt":"2026-02-03 08:31:18","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-8773066/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8773066/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":107629054,"identity":"510d711c-0e55-47f0-ae39-449fac932b06","added_by":"auto","created_at":"2026-04-23 11:19:45","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":280531,"visible":true,"origin":"","legend":"Article File","description":"","filename":"RECURSUMSpringerNature.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8773066/v1_covered_7c5f60af-716a-468c-b711-897c27f5c79b.pdf"},{"id":107629053,"identity":"aa3d64d6-066f-430e-ba74-e8bb8f3d4419","added_by":"auto","created_at":"2026-04-23 11:19:40","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"supplement","size":964828,"visible":true,"origin":"","legend":"Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation","description":"","filename":"SIRECURSUMmanuscriptfinalnature.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8773066/v1/f41c767d26e2a1bfa57ddc67.pdf"}],"financialInterests":"There is \u003cb\u003eNO\u003c/b\u003e Competing Interest.","formattedTitle":"Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Scientific computing, Recurrence relations, Domain-specific language, Automatic code generation","lastPublishedDoi":"10.21203/rs.3.rs-8773066/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8773066/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"Recurrence relations are computational primitives across scientific computing, from orthogonal polynomials to molecular integral evaluation. Traditional implementations face a dual expertise barrier: domain scientists lack C++ optimisation skills, whilst software engineers lack domain knowledge. We present RECURSUM, a Python-based domain-specific language automatically generating optimised C++ code for arbitrary recurrence relations. Our LayeredCodegen backend achieves 9.8× speedup over expert hand-written implementations and 1.9× over template metaprogramming for McMurchie-Davidson Hermite coefficients--inverting the conventional hierarchy where manual optimisation defines the ceiling. Three systematic optimisations explain this: zero-copy output parameters (23× bandwidth reduction), guaranteed function inlining, and exact-sized stack buffers (100\\% vs 27\\% cache efficiency). Validated across 24 recurrence types spanning quantum chemistry, numerical analysis, and special functions on CPU backends (x86-64, ARM64), RECURSUM demonstrates automated generation can serve as the performance ceiling. The single-source specification architecture enables hardware portability, with GPU/FPGA/TPU backends planned. This paradigm shift democratises high-performance computing by eliminating the expertise barrier whilst systematically exceeding manual optimisation.","manuscriptTitle":"Automated Code Generation for Recurrence Relations Systematically Exceeds Expert Optimisation","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-04-23 11:19:23","doi":"10.21203/rs.3.rs-8773066/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"1fb96d67-a32d-4270-b5db-9eec61d05fa8","owner":[],"postedDate":"April 23rd, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[{"id":62251566,"name":"Physical sciences/Mathematics and computing/Applied mathematics"},{"id":62251567,"name":"Physical sciences/Mathematics and computing/Computational science"},{"id":62251568,"name":"Physical sciences/Physics/Quantum physics"},{"id":62251569,"name":"Physical sciences/Chemistry/Theoretical chemistry/Quantum chemistry"}],"tags":[],"updatedAt":"2026-04-23T11:19:23+00:00","versionOfRecord":[],"versionCreatedAt":"2026-04-23 11:19:23","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8773066","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8773066","identity":"rs-8773066","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2026) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00