Oh, sure - I was actually mainly thinking about matrices. I was looking for 
something like fma! in ArrayFire (without success), and then wondered what 
it might be called in Base.

On Saturday, July 23, 2016 at 8:04:31 PM UTC+2, Stefan Karpinski wrote:
>
> They don't make sense for scalars but they could be added for matrices.
>
> On Sat, Jul 23, 2016 at 1:54 PM, Oliver Schulz <[email protected] 
> <javascript:>> wrote:
>
>> Hi Stefan,
>>
>> sorry, yes, I had somehow overlooked fma. Mainly I was looking for an 
>> in-place version though, like fma! and muladd!. Is there a reason those 
>> don't exist?
>>
>> On Saturday, July 23, 2016 at 7:50:30 PM UTC+2, Stefan Karpinski wrote:
>>>
>>> Yes: https://github.com/JuliaLang/julia/issues/6330. In short, there 
>>> are both fma and muladd operations with different purposes:
>>>
>>> help?> fma                                                               
>>>                                                                             
>>>                            
>>> search: fma findmax @fastmath UniformScaling                             
>>>                                                                             
>>>                            
>>>                                                                         
>>>                                                                             
>>>                             
>>>   fma(x, y, z)                                                           
>>>                                                                             
>>>                            
>>>                                                                         
>>>                                                                             
>>>                             
>>>   Computes x*y+z without rounding the intermediate result x*y. On some 
>>> systems this is significantly more expensive than x*y+z. fma is used to 
>>> improve accuracy in certain algorithms. See muladd.                         
>>>                                                                             
>>>                                                   
>>>                                                                         
>>>                                                                             
>>>                             
>>> help?> muladd                                                           
>>>                                                                             
>>>                             
>>> search: muladd                                                           
>>>                                                                             
>>>                            
>>>                                                                         
>>>                                                                             
>>>                             
>>>   muladd(x, y, z)                                                       
>>>                                                                             
>>>                             
>>>                                                                         
>>>                                                                             
>>>                             
>>>   Combined multiply-add, computes x*y+z in an efficient manner. This may 
>>> on some systems be equivalent to x*y+z, or to fma(x,y,z). muladd is used to 
>>> improve performance. See fma.
>>>
>>> On Sat, Jul 23, 2016 at 1:40 PM, Oliver Schulz <[email protected]
>>> > wrote:
>>>
>>>> Does Julia have a standardized FMA (Fused-Multiply-Add) function? Like 
>>>> fma(A, B, factor) and fma!(dest, A, B, factor), so that that GPU 
>>>> libraries, 
>>>> etc. can provide optimized versions?
>>>>
>>>
>>>
>

Reply via email to