Sundials/ML: Connecting OCaml to the Sundials Numeric Solvers

CoRR Pub Date : 2018-12-31 DOI:10.4204/EPTCS.285.4
T. Bourke, Jun Inoue, Marc Pouzet
{"title":"Sundials/ML: Connecting OCaml to the Sundials Numeric Solvers","authors":"T. Bourke, Jun Inoue, Marc Pouzet","doi":"10.4204/EPTCS.285.4","DOIUrl":null,"url":null,"abstract":"This paper describes the design and implementation of a comprehensive OCaml interface to the Sundials library of numeric solvers for ordinary differential equations, differential algebraic equations, and non-linear equations. The interface provides a convenient and memory-safe alternative to using Sundials directly from C and facilitates application development by integrating with higher-level language features, like garbage-collected memory management, algebraic data types, and exceptions. Our benchmark results suggest that the interface overhead is acceptable: the standard examples are rarely twice as slow in OCaml than in C, and often less than 50% slower. The challenges in interfacing with Sundials are to efficiently and safely share data structures between OCaml and C, to support multiple implementations of vector operations and linear solvers through a common interface, and to manage calls and error signalling to and from OCaml. We explain how we overcame these difficulties using a combination of standard techniques such as phantom types and polymorphic variants, and carefully crafted data representations.","PeriodicalId":10720,"journal":{"name":"CoRR","volume":"25 1","pages":"101-130"},"PeriodicalIF":0.0000,"publicationDate":"2018-12-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"CoRR","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4204/EPTCS.285.4","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

This paper describes the design and implementation of a comprehensive OCaml interface to the Sundials library of numeric solvers for ordinary differential equations, differential algebraic equations, and non-linear equations. The interface provides a convenient and memory-safe alternative to using Sundials directly from C and facilitates application development by integrating with higher-level language features, like garbage-collected memory management, algebraic data types, and exceptions. Our benchmark results suggest that the interface overhead is acceptable: the standard examples are rarely twice as slow in OCaml than in C, and often less than 50% slower. The challenges in interfacing with Sundials are to efficiently and safely share data structures between OCaml and C, to support multiple implementations of vector operations and linear solvers through a common interface, and to manage calls and error signalling to and from OCaml. We explain how we overcame these difficulties using a combination of standard techniques such as phantom types and polymorphic variants, and carefully crafted data representations.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
日晷/ML:将OCaml连接到日晷数字求解器
本文描述了一个全面的OCaml接口的设计和实现,该接口用于Sundials库的常微分方程,微分代数方程和非线性方程的数值求解器。该接口为直接从C中使用Sundials提供了一种方便且内存安全的替代方案,并通过集成更高级的语言特性(如垃圾收集内存管理、代数数据类型和异常)来促进应用程序开发。我们的基准测试结果表明接口开销是可以接受的:OCaml中的标准示例很少比C中的慢两倍,并且通常慢不到50%。与Sundials接口的挑战是在OCaml和C之间高效安全地共享数据结构,通过公共接口支持向量操作和线性求解器的多种实现,以及管理与OCaml之间的调用和错误信号。我们解释了如何使用诸如幻影类型和多态变体等标准技术以及精心制作的数据表示的组合来克服这些困难。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Intersection Types for Unboundedness Problems Natural Deduction and Normalization Proofs for the Intersection Type Discipline Intersection Subtyping with Constructors Formalization of Automated Trading Systems in a Concurrent Linear Framework Taking Linear Logic Apart
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1