{"id":10993,"date":"2015-04-07T10:00:44","date_gmt":"2015-04-07T14:00:44","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10993"},"modified":"2015-04-07T10:01:06","modified_gmt":"2015-04-07T14:01:06","slug":"swift-accelerate-and-generics","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/04\/07\/swift-accelerate-and-generics\/","title":{"rendered":"Swift, Accelerate, and Generics"},"content":{"rendered":"<p><a href=\"http:\/\/www.supermegaultragroovy.com\/2015\/02\/19\/mixing-swift-and-generics\/\">Chris Liscio<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.supermegaultragroovy.com\/2015\/02\/19\/mixing-swift-and-generics\/\"><p>After spending a while in a Playground, I managed to get a generic vDSP multiply routine written that could work on both <code>Slice&lt;Float&gt;<\/code> and <code>[Float]<\/code>.<\/p><p>For no good reason at all, I decided that I should brain-dump this approach into my <a href=\"http:\/\/github.com\/liscio\/SMUGMath-Swift\">SMUGMath-Swift<\/a> project before I lose the playground to the sands of time.<\/p><p>The &ldquo;magic&rdquo; is in the way that I was able to lean on the <code>withUnsafeBufferPointer<\/code> method that exists for both collection types, and then also specify some additional type clauses to ensure we&rsquo;re working with <code>Float<\/code> vs <code>Double<\/code> floating point types.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Chris Liscio: After spending a while in a Playground, I managed to get a generic vDSP multiply routine written that could work on both Slice&lt;Float&gt; and [Float].For no good reason at all, I decided that I should brain-dump this approach into my SMUGMath-Swift project before I lose the playground to the sands of time.The &ldquo;magic&rdquo; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[74,138,71,901],"class_list":["post-10993","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-opensource","tag-optimization","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=10993"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10993\/revisions"}],"predecessor-version":[{"id":10994,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10993\/revisions\/10994"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}