关于用于 MATLAB 代码原型开发的矢量化基本线性代数软件包

Alexej Moskovka, Talal Rahman, Jan Valdman, Jon Eivind Vatne
{"title":"关于用于 MATLAB 代码原型开发的矢量化基本线性代数软件包","authors":"Alexej Moskovka, Talal Rahman, Jan Valdman, Jon Eivind Vatne","doi":"arxiv-2404.16039","DOIUrl":null,"url":null,"abstract":"When writing high-performance code for numerical computation in a scripting\nlanguage like MATLAB, it is crucial to have the operations in a large for-loop\nvectorized. If not, the code becomes too slow to use, even for a moderately\nlarge problem. However, in the process of vectorizing, the code often loses its\noriginal structure and becomes less readable. This is particularly true in the\ncase of a finite element implementation, even though finite element methods are\ninherently structured. A basic remedy to this is the separation of the\nvectorization part from the mathematics part of the code, which is easily\nachieved through building the code on top of the basic linear algebra\nsubprograms that are already vectorized codes, an idea that has been used in a\nseries of papers over the last fifteen years, developing codes that are fast\nand still structured and readable. We discuss the vectorized basic linear\nalgebra package and introduce a formalism using multi-linear algebra to explain\nand define formally the functions in the package, as well as MATLAB pagetime\nfunctions. We provide examples from computations of varying complexity,\nincluding the computation of normal vectors, volumes, and finite element\nmethods. Benchmarking shows that we also get fast computations. Using the\nlibrary, we can write codes that closely follow our mathematical thinking,\nmaking writing, following, reusing, and extending the code easier.","PeriodicalId":501256,"journal":{"name":"arXiv - CS - Mathematical Software","volume":"105 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-03-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"On a vectorized basic linear algebra package for prototyping codes in MATLAB\",\"authors\":\"Alexej Moskovka, Talal Rahman, Jan Valdman, Jon Eivind Vatne\",\"doi\":\"arxiv-2404.16039\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"When writing high-performance code for numerical computation in a scripting\\nlanguage like MATLAB, it is crucial to have the operations in a large for-loop\\nvectorized. If not, the code becomes too slow to use, even for a moderately\\nlarge problem. However, in the process of vectorizing, the code often loses its\\noriginal structure and becomes less readable. This is particularly true in the\\ncase of a finite element implementation, even though finite element methods are\\ninherently structured. A basic remedy to this is the separation of the\\nvectorization part from the mathematics part of the code, which is easily\\nachieved through building the code on top of the basic linear algebra\\nsubprograms that are already vectorized codes, an idea that has been used in a\\nseries of papers over the last fifteen years, developing codes that are fast\\nand still structured and readable. We discuss the vectorized basic linear\\nalgebra package and introduce a formalism using multi-linear algebra to explain\\nand define formally the functions in the package, as well as MATLAB pagetime\\nfunctions. We provide examples from computations of varying complexity,\\nincluding the computation of normal vectors, volumes, and finite element\\nmethods. Benchmarking shows that we also get fast computations. Using the\\nlibrary, we can write codes that closely follow our mathematical thinking,\\nmaking writing, following, reusing, and extending the code easier.\",\"PeriodicalId\":501256,\"journal\":{\"name\":\"arXiv - CS - Mathematical Software\",\"volume\":\"105 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-03-15\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Mathematical Software\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2404.16039\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Mathematical Software","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2404.16039","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

在 MATLAB 等脚本语言中编写高性能数值计算代码时,将大型 for 循环中的操作矢量化至关重要。否则,即使是处理中等规模的问题,代码也会变得太慢而无法使用。然而,在矢量化的过程中,代码往往会失去原有的结构,可读性也会降低。这在有限元实现中尤为明显,尽管有限元方法本身就是结构化的。解决这一问题的基本方法是将代码的矢量化部分与数学部分分离,这可以通过在已经是矢量化代码的基本线性代数子程序之上构建代码来轻松实现,过去 15 年中的一系列论文都采用了这一思路,开发出了既快速又具有结构性和可读性的代码。我们讨论了矢量化基本线性代数软件包,并介绍了一种使用多线性代数的形式主义,以正式解释和定义软件包中的函数以及 MATLAB 分页函数。我们提供了不同复杂度的计算实例,包括法向量、体积和有限元素方法的计算。基准测试表明,我们也能获得快速计算。使用该库,我们可以编写紧跟数学思维的代码,使代码的编写、跟踪、重用和扩展变得更加容易。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
On a vectorized basic linear algebra package for prototyping codes in MATLAB
When writing high-performance code for numerical computation in a scripting language like MATLAB, it is crucial to have the operations in a large for-loop vectorized. If not, the code becomes too slow to use, even for a moderately large problem. However, in the process of vectorizing, the code often loses its original structure and becomes less readable. This is particularly true in the case of a finite element implementation, even though finite element methods are inherently structured. A basic remedy to this is the separation of the vectorization part from the mathematics part of the code, which is easily achieved through building the code on top of the basic linear algebra subprograms that are already vectorized codes, an idea that has been used in a series of papers over the last fifteen years, developing codes that are fast and still structured and readable. We discuss the vectorized basic linear algebra package and introduce a formalism using multi-linear algebra to explain and define formally the functions in the package, as well as MATLAB pagetime functions. We provide examples from computations of varying complexity, including the computation of normal vectors, volumes, and finite element methods. Benchmarking shows that we also get fast computations. Using the library, we can write codes that closely follow our mathematical thinking, making writing, following, reusing, and extending the code easier.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信