{"title":"可变运算可变运算 API","authors":"Benoît Legat","doi":"10.21105/jcon.00093","DOIUrl":null,"url":null,"abstract":"Arithmetic operations defined in Julia do not modify their arguments. However, in many situations, a variable represents an ac-cumulator that can be modified in-place to contain the result, e.g., when summing the elements of an array. Moreover, for types that support mutation, mutating the value may have a significant performance benefit over creating a new instance. This paper presents an interface that allows algorithms to exploit mutability in arithmetic operations in a generic manner.","PeriodicalId":443465,"journal":{"name":"JuliaCon Proceedings","volume":" 12","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-04-18","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"MutableArithmetics: An API for mutable operations\",\"authors\":\"Benoît Legat\",\"doi\":\"10.21105/jcon.00093\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Arithmetic operations defined in Julia do not modify their arguments. However, in many situations, a variable represents an ac-cumulator that can be modified in-place to contain the result, e.g., when summing the elements of an array. Moreover, for types that support mutation, mutating the value may have a significant performance benefit over creating a new instance. This paper presents an interface that allows algorithms to exploit mutability in arithmetic operations in a generic manner.\",\"PeriodicalId\":443465,\"journal\":{\"name\":\"JuliaCon Proceedings\",\"volume\":\" 12\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-04-18\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"JuliaCon Proceedings\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.21105/jcon.00093\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"JuliaCon Proceedings","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.21105/jcon.00093","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
摘要
Julia 中定义的算术运算不会修改参数。然而,在许多情况下,变量代表一个累加器,可以就地修改累加器以包含结果,例如,在求数组元素的总和时。此外,对于支持突变的类型,与创建新实例相比,突变值可能会带来显著的性能优势。本文提出了一种接口,允许算法以通用方式利用算术运算中的可变性。
Arithmetic operations defined in Julia do not modify their arguments. However, in many situations, a variable represents an ac-cumulator that can be modified in-place to contain the result, e.g., when summing the elements of an array. Moreover, for types that support mutation, mutating the value may have a significant performance benefit over creating a new instance. This paper presents an interface that allows algorithms to exploit mutability in arithmetic operations in a generic manner.