<div dir="ltr"><div>SwiftGL isn't "naive Swift" except where it can't use the SIMD module.</div><div><br></div><div>-david</div><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 18, 2016 at 5:09 PM, Dmitri Gribenko <span dir="ltr"><<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Mon, Jan 18, 2016 at 5:06 PM, David Turnbull via swift-users<br>
<<a href="mailto:swift-users@swift.org">swift-users@swift.org</a>> wrote:<br>
> How about this...<br>
><br>
> public func dot<genType:FloatingPointVectorType>(x:genType, _ y:genType) -><br>
> genType.Element {<br>
><br>
> let a = genType(x, y, *)<br>
><br>
> return a.reduce(genType.Element(0)) { $0 + ($1 as! genType.Element) }<br>
><br>
> }<br>
<br>
</span>This won't be calling into Accelerate. The assumption is that<br>
Accelerate is manually-optimized and heavily tuned, and it will be<br>
faster than a naive Swift implementation.<br>
<div class=""><div class="h5"><br>
Dmitri<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
</div></div></blockquote></div><br></div></div>