1"use strict";(self.webpackChunkmodular_fe=self.webpackChunkmodular_fe||[]).push([["13083"],{16899(s,e,a){a.r(e),a.d(e,{metadata:()=>n,default:()=>d,frontMatter:()=>l,contentTitle:()=>m,toc:()=>r,assets:()=>c});var n=JSON.parse('{"id":"docs/std/math/math/fma","title":"fma","description":"Performs elementwise `fma` (fused multiply-add) on the inputs.","source":"@site/versioned_docs/version-1.1.0/docs/std/math/math/fma.md","sourceDirName":"docs/std/math/math","slug":"/docs/std/math/math/fma","permalink":"/docs/std/math/math/fma","draft":false,"unlisted":false,"editUrl":"https://github.com/modular/modular/edit/main/Mojo/docs/site/std/math/math/fma.md","tags":[],"version":"1.1.0","frontMatter":{"title":"fma","version":"1.1.0.dev0","slug":"fma","type":"function","namespace":"std.math.math","lang":"mojo","show_stability_marker":null,"description":"Performs elementwise `fma` (fused multiply-add) on the inputs."},"sidebar":"stdSidebar","previous":{"title":"floor","permalink":"/docs/std/math/math/floor"},"next":{"title":"frexp","permalink":"/docs/std/math/math/frexp"}}'),i=a(74848),t=a(28453);let l={title:"fma",version:"1.1.0.dev0",slug:"fma",type:"function",namespace:"std.math.math",lang:"mojo",show_stability_marker:null,description:"Performs elementwise `fma` (fused multiply-add) on the inputs."},m,c={},r=[];function h(s){let e={a:"a",annotation:"annotation",b:"b",code:"code",div:"div",li:"li",math:"math",mi:"mi",mo:"mo",mrow:"mrow",msub:"msub",p:"p",section:"section",semantics:"semantics",span:"span",strong:"strong",ul:"ul",...(0,t.R)(),...s.components};return(0,i.jsxs)(e.section,{className:"mojo-docs",children:["\n",(0,i.jsxs)(e.div,{className:"mojo-function-detail",children:["\n",(0,i.jsxs)(e.div,{className:"mojo-function-sig",children:["\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.code,{children:"def fma[dtype: DType, width: SIMDLength, //](a: SIMD[dtype, width], b: SIMD[dtype, width], c: SIMD[dtype, width]) -> SIMD[dtype, width]"})}),"\n"]}),"\n",(0,i.jsxs)(e.p,{children:["Performs elementwise ",(0,i.jsx)(e.code,{children:"fma"})," (fused multiply-add) on the inputs."]}),"\n",(0,i.jsxs)(e.p,{children:["Each element in the result SIMD vector is ",(0,i.jsxs)(e.span,{className:"katex",children:[(0,i.jsx)(e.span,{className:"katex-mathml",children:(0,i.jsx)(e.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,i.jsxs)(e.semantics,{children:[(0,i.jsxs)(e.mrow,{children:[(0,i.jsx)(e.mo,{stretchy:"false",children:"("}),(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"A"}),(0,i.jsx)(e.mi,{children:"i"})]}),(0,i.jsx)(e.mo,{children:"\u2217"}),(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"B"}),(0,i.jsx)(e.mi,{children:"i"})]}),(0,i.jsx)(e.mo,{stretchy:"false",children:")"}),(0,i.jsx)(e.mo,{children:"+"}),(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"C"}),(0,i.jsx)(e.mi,{children:"i"})]})]}),(0,i.jsx)(e.annotation,{encoding:"application/x-tex",children:"(A_i * B_i) + C_i"})]})})}),(0,i.jsxs)(e.span,{className:"katex-html","aria-hidden":"true",children:[(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"1em",verticalAlign:"-0.25em"}}),(0,i.jsx)(e.span,{className:"mopen",children:"("}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",children:"A"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.3117em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"0em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]}),(0,i.jsx)(e.span,{className:"mspace",style:{marginRight:"0.2222em"}}),(0,i.jsx)(e.span,{className:"mbin",children:"\u2217"}),(0,i.jsx)(e.span,{className:"mspace",style:{marginRight:"0.2222em"}})]}),(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"1em",verticalAlign:"-0.25em"}}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",style:{marginRight:"0.0502em"},children:"B"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.311
17em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"-0.0502em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]}),(0,i.jsx)(e.span,{className:"mclose",children:")"}),(0,i.jsx)(e.span,{className:"mspace",style:{marginRight:"0.2222em"}}),(0,i.jsx)(e.span,{className:"mbin",children:"+"}),(0,i.jsx)(e.span,{className:"mspace",style:{marginRight:"0.2222em"}})]}),(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"0.8333em",verticalAlign:"-0.15em"}}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",style:{marginRight:"0.0715em"},children:"C"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.3117em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"-0.0715em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]})]})]})]}),", where ",(0,i.jsxs)(e.span,{className:"katex",children:[(0,i.jsx)(e.span,{className:"katex-mathml",children:(0,i.jsx)(e.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,i.jsxs)(e.semantics,{children:[(0,i.jsx)(e.mrow,{children:(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"A"}),(0,i.jsx)(e.mi,{children:"i"})]})}),(0,i.jsx)(e.annotation,{encoding:"application/x-tex",children:"A_i"})]})})}),(0,i.jsx)(e.span,{className:"katex-html","aria-hidden":"true",children:(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"0.8333em",verticalAlign:"-0.15em"}}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",children:"A"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.3117em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"0em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]})]})})]}),",\n",(0,i.jsxs)(e.span,{className:"katex",children:[(0,i.jsx)(e.span,{className:"katex-mathml",children:(0,i.jsx)(e.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,i.jsxs)(e.semantics,{children:[(0,i.jsx)(e.mrow,{children:(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"B"}),(0,i.jsx)(e.mi,{children:"i"})]})}),(0,i.jsx)(e.annotation,{encoding:"application/x-tex",children:"B_i"})]})})}),(0,i.jsx)(e.span,{className:"katex-html","aria-hidden":"true",children:(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"0.8333em",verticalAlign:"-0.15em"}}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",style:{marginRight:"0.0502em"},children:"B"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.311
17em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"-0.0502em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]})]})})]})," and ",(0,i.jsxs)(e.span,{className:"katex",children:[(0,i.jsx)(e.span,{className:"katex-mathml",children:(0,i.jsx)(e.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,i.jsxs)(e.semantics,{children:[(0,i.jsx)(e.mrow,{children:(0,i.jsxs)(e.msub,{children:[(0,i.jsx)(e.mi,{children:"C"}),(0,i.jsx)(e.mi,{children:"i"})]})}),(0,i.jsx)(e.annotation,{encoding:"application/x-tex",children:"C_i"})]})})}),(0,i.jsx)(e.span,{className:"katex-html","aria-hidden":"true",children:(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"0.8333em",verticalAlign:"-0.15em"}}),(0,i.jsxs)(e.span,{className:"mord",children:[(0,i.jsx)(e.span,{className:"mord mathnormal",style:{marginRight:"0.0715em"},children:"C"}),(0,i.jsx)(e.span,{className:"msupsub",children:(0,i.jsxs)(e.span,{className:"vlist-t vlist-t2",children:[(0,i.jsxs)(e.span,{className:"vlist-r",children:[(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.3117em"},children:(0,i.jsxs)(e.span,{style:{top:"-2.55em",marginLeft:"-0.0715em",marginRight:"0.05em"},children:[(0,i.jsx)(e.span,{className:"pstrut",style:{height:"2.7em"}}),(0,i.jsx)(e.span,{className:"sizing reset-size6 size3 mtight",children:(0,i.jsx)(e.span,{className:"mord mathnormal mtight",children:"i"})})]})}),(0,i.jsx)(e.span,{className:"vlist-s",children:"\u200B"})]}),(0,i.jsx)(e.span,{className:"vlist-r",children:(0,i.jsx)(e.span,{className:"vlist",style:{height:"0.15em"},children:(0,i.jsx)(e.span,{})})})]})})]})]})})]})," are elements at index ",(0,i.jsxs)(e.span,{className:"katex",children:[(0,i.jsx)(e.span,{className:"katex-mathml",children:(0,i.jsx)(e.math,{xmlns:"http://www.w3.org/1998/Math/MathML",children:(0,i.jsxs)(e.semantics,{children:[(0,i.jsx)(e.mrow,{children:(0,i.jsx)(e.mi,{children:"i"})}),(0,i.jsx)(e.annotation,{encoding:"application/x-tex",children:"i"})]})})}),(0,i.jsx)(e.span,{className:"katex-html","aria-hidden":"true",children:(0,i.jsxs)(e.span,{className:"base",children:[(0,i.jsx)(e.span,{className:"strut",style:{height:"0.6595em"}}),(0,i.jsx)(e.span,{className:"mord mathnormal",children:"i"})]})})]})," in a, b, and c respectively."]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Parameters:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["\u200B",(0,i.jsx)(e.b,{children:"dtype"})," (",(0,i.jsx)(e.a,{href:"../../../../../docs/std/builtin/dtype/DType",children:(0,i.jsx)(e.code,{children:"DType"})}),"): The ",(0,i.jsx)(e.code,{children:"dtype"})," of the input SIMD vector."]}),"\n",(0,i.jsxs)(e.li,{children:["\u200B",(0,i.jsx)(e.b,{children:"width"})," (",(0,i.jsx)(e.a,{href:"../../../../../docs/std/builtin/simd_length/SIMDLength",children:(0,i.jsx)(e.code,{children:"SIMDLength"})}),"): The width of the input and output SIMD vector."]}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Args:"})}),"\n",(0,i.jsxs)(e.ul,{children:["\n",(0,i.jsxs)(e.li,{children:["\u200B",(0,i.jsx)(e.b,{children:"a"})," (",(0,i.jsx)(e.a,{href:"../../../../../docs/std/simd/SIMD",children:(0,i.jsx)(e.code,{children:"SIMD[dtype, width]"})}),"): The first vector of inputs."]}),"\n",(0,i.jsxs)(e.li,{children:["\u200B",(0,i.jsx)(e.b,{children:"b"})," (",(0,i.jsx)(e.a,{href:"../../../../../docs/std/simd/SIMD",children:(0,i.jsx)(e.code,{children:"SIMD[dtype, width]"})}),"): The second vector of inputs."]}),"\n",(0,i.jsxs)(e.li,{children:["\u200B",(0,i.jsx)(e.b,{children:"c"})," (",(0,i.jsx)(e.a,{href:"../../../../../docs/std/simd/SIMD",children:(0,i.jsx)(e.code,{children:"SIMD[dtype, width]"})}),"): The third vector of inputs."]}),"\n"]}),"\n",(0,i.jsx)(e.p,{children:(0,i.jsx)(e.strong,{children:"Returns:"})}),"\n",(0,i.jsxs)(e.p,{children:[(0,i.jsx)(e.a,{href:"../../../../../docs/std/simd/SIMD",children:(0,i.jsx)(e.code,{children:"SIMD[dtype, width]"})}),": Elementwise ",(0,i.jsx)(e.code,{children:"fma"})," of a, b and c."]}),"\n"]}),"\n"]})}function d(s={}){let{wrapper:e}={...(0,t.R)(),...s.components};return e?(0,i.jsx)(e,{...s,children:(0,i.jsx)(h,{...s})}):h(s)}},28453(s,e,a){a.d(e,{R:()=>l,x:()=>m});var n=a(96540);let i={},t=n.createContext(i);function l(s){let e=n.useContext(t);return n.useMemo(function(){return"function"==typeof s?s(e):{...e,...s}},[e,s])}function m(s){let e;return e=s.disableParentContext?"function"==typeof s.components?s.components(i):s.components||i:l(s.components),n.createElement(t.Provider,{value:e},s.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.