<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Satnam Singh&amp;#39;s MSDN Blog</title><subtitle type="html" /><id>http://blogs.msdn.com/b/satnam_singh/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/satnam_singh/atom.aspx" /><generator uri="http://telligent.com" version="5.6.583.17018">Telligent Community 5.6.583.17018 (Build: 5.6.583.17018)</generator><updated>2009-12-15T13:50:00Z</updated><entry><title>The ADSR Envelope of Programming (Humour)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/08/04/the-adsr-envelope-of-programming-humour.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/08/04/the-adsr-envelope-of-programming-humour.aspx</id><published>2011-08-04T13:49:51Z</published><updated>2011-08-04T13:49:51Z</updated><content type="html">For those of you that grew up with ADSR envelopes on the BBC Microcomputer or the Commodore 64 or on your Korg....(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/08/04/the-adsr-envelope-of-programming-humour.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10192781" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>The Last Programmer Standing will be holding an FPGA</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/08/01/the-last-programmer-standing-will-be-holding-an-fpga.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/08/01/the-last-programmer-standing-will-be-holding-an-fpga.aspx</id><published>2011-08-01T10:22:32Z</published><updated>2011-08-01T10:22:32Z</updated><content type="html">In my article Computing Without Processors http://cacm.acm.org/magazines/2011/8/114935-computing-without-processors/fulltext in the August edition of Communications of the ACM I advocate the deployment of heterogeneous computing technology to help address the ever pressing requirements we have for computing with reduced latency and reduced energy consumption. Significant challenges lie ahead for those that try to reign in the extreme computing and communication power offered by alternative architectures...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/08/01/the-last-programmer-standing-will-be-holding-an-fpga.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10191617" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="GPGPU" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/GPGPU/" /><category term="multicore" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/multicore/" /><category term="high level synthesis" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/high+level+synthesis/" /><category term="hardware compilation" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/hardware+compilation/" /><category term="cloud computing" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/cloud+computing/" /><category term="data centres" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/data+centres/" /><category term="data centers" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/data+centers/" /><category term="interop" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/interop/" /></entry><entry><title>Computing Without Processors article on ACM Queue</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/06/28/computing-without-processors-article-on-acm-queue.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/06/28/computing-without-processors-article-on-acm-queue.aspx</id><published>2011-06-28T10:12:42Z</published><updated>2011-06-28T10:12:42Z</updated><content type="html">My article on Computing Without Processors is on the ACM Queue page now: http://queue.acm.org/detail.cfm?id=2000516 The article explains why it is important for us to learn to program not just regular microprocessors but also many other kinds of computing elements. As we struggle to meet the latency and energy consumption constraints we will inevitably be forced to use heterogeneous architectures which comprise the evolution of today's GPUs (for data-parallelism) and FPGA (for 2D and 3D spatial computing...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/06/28/computing-without-processors-article-on-acm-queue.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10180846" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Creating a Windows DLL from a Haskell Program and calling it from C++</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/04/19/creating-a-windows-dll-from-a-haskell-program-and-calling-it-from-c.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/04/19/creating-a-windows-dll-from-a-haskell-program-and-calling-it-from-c.aspx</id><published>2011-04-19T16:40:57Z</published><updated>2011-04-19T16:40:57Z</updated><content type="html">Every so often you have to leave the warm comfortable safe world of Haskell and venture out into what some unsavoury types call the "the real world". I've always thought it better to call the real world rather than have it call on me in Haskell-land. But when that does not work you have the bite the bullet and make a DLL that can be called from other Windows programs. Every so often I do this and it works (for a single DLL) and then time passes and GHC changes and then suddenly you have to do something...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/04/19/creating-a-windows-dll-from-a-haskell-program-and-calling-it-from-c.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10155815" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="DLLs" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/DLLs/" /><category term="foreign function interfaces" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/foreign+function+interfaces/" /><category term="interop" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/interop/" /><category term="Haskell" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/Haskell/" /></entry><entry><title>Compiling C# Programs to FPGA Circuits: An Ethernet Packet Processing Example</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/02/15/compiling-c-programs-to-fpga-circuits-an-ethernet-packing-processing-example.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/02/15/compiling-c-programs-to-fpga-circuits-an-ethernet-packing-processing-example.aspx</id><published>2011-02-15T18:10:46Z</published><updated>2011-02-15T18:10:46Z</updated><content type="html">In a previous blog article I showed how to get the default Ethernet address swap circuit working on the ML605 board. The address swap module (which can be generated in VHDL or Verilog) is tedious to write yourself because you have to explicitly write it as a state machine. In typical hardware description languages you have "lost the semicolon" and the program you write very much resembles coding with call-backs in GUIs or REST-style programming or writing directly in continuation passing style. With...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/02/15/compiling-c-programs-to-fpga-circuits-an-ethernet-packing-processing-example.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10129709" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="C#" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/C_2300_/" /><category term="high level synthesis" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/high+level+synthesis/" /><category term="FPGA" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/FPGA/" /><category term="hardware compilation" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/hardware+compilation/" /><category term="Ethernet" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/Ethernet/" /></entry><entry><title>Using the Virtex-6 Embedded Tri-Mode Ethernet MAC Wrapper v1.4 with the ML605 Board</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/02/11/using-the-virtex-6-embedded-tri-mode-ethernet-mac-wrapper-v1-4-with-the-ml605-board.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/02/11/using-the-virtex-6-embedded-tri-mode-ethernet-mac-wrapper-v1-4-with-the-ml605-board.aspx</id><published>2011-02-11T13:10:13Z</published><updated>2011-02-11T13:10:13Z</updated><content type="html">Whenever I get a new Xilinx development board I go through the tedious process of porting my circuits that use Ethernet communication to the new board. To save other people the pain I went through to get this to work I have written this blog which outlines the changes you need to make to the automatically generated Ethernet MAC wrapper to make the default echo circuit work. Note that these instructions only apply to the Xilinx ML605 development board : I have tested these instructions with ISE version...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/02/11/using-the-virtex-6-embedded-tri-mode-ethernet-mac-wrapper-v1-4-with-the-ml605-board.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10128012" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="FPGA" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/FPGA/" /><category term="Ethernet" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/Ethernet/" /><category term="Xilinx" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/Xilinx/" /></entry><entry><title>Reconfigurable Data Processing for Clouds</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/01/18/reconfigurable-data-processing-for-clouds.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/01/18/reconfigurable-data-processing-for-clouds.aspx</id><published>2011-01-18T14:28:20Z</published><updated>2011-01-18T14:28:20Z</updated><content type="html">Along with Anil Madhavapeddy at the University of Cambridge I've been thinking about how to apply reconfigurable computing technology (for example FPGAs ) in data-centres and in cloud computing systems. Reconfigurable computing for some time now has had the potential to make a huge impact on mainstream high performance computing. We will soon have a million LUTs or more of highly parallel fine grain parallel processing power, and the ability to define high bandwidth custom memory hierarchies offers...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/01/18/reconfigurable-data-processing-for-clouds.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10117085" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="GPGPU" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/GPGPU/" /><category term="multicore" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/multicore/" /><category term="FPGA" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/FPGA/" /><category term="cloud computing" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/cloud+computing/" /><category term="data centres" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/data+centres/" /><category term="data centers" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/data+centers/" /></entry><entry><title>Computing a Parallel Facebook Life</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2011/01/14/computing-a-parallel-facebook-life.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2011/01/14/computing-a-parallel-facebook-life.aspx</id><published>2011-01-14T22:41:38Z</published><updated>2011-01-14T22:41:38Z</updated><content type="html">Soon there will be so much information about our lives entered into social network systems to allow us to perform calculations with this historical data to compute "what-if" scenarios i.e. compute a parallel life we could have had if we had made some different decision in the past. For example, if I had gone to Bill's party instead of Craig's party two years ago I would have met Bob there and never have met Anders etc. etc. We could synthesize an entire parallel life based on all the information...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2011/01/14/computing-a-parallel-facebook-life.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10116036" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="Social Networks" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/Social+Networks/" /></entry><entry><title>Learn about alternative high performance computing at the FPGA 2011 conference</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/12/28/learn-about-alternative-high-performance-computing-at-the-fpga-2011-conference.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/12/28/learn-about-alternative-high-performance-computing-at-the-fpga-2011-conference.aspx</id><published>2010-12-28T13:01:58Z</published><updated>2010-12-28T13:01:58Z</updated><content type="html">The ACM/SIGDA International Symposium on Field-Programmable Gate Arrays is the premier conference for presentation of advances in all areas related to FPGA technology. FPGAs for computing used to be confined to a niche market of engineers that were willing to carefully hand craft circuits to get extreme performance that could not be achieved with regular processors or GPUs. Today FPGAs are become one of the exciting new processing elements that form the heart of heterogeneous computing systems that...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/12/28/learn-about-alternative-high-performance-computing-at-the-fpga-2011-conference.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10109535" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Compiling C# Programs into FPGA Circuits: Factorial Example</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/10/15/compiling-c-programs-into-fpga-circuits-factorial-example.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/10/15/compiling-c-programs-into-fpga-circuits-factorial-example.aspx</id><published>2010-10-15T15:34:07Z</published><updated>2010-10-15T15:34:07Z</updated><content type="html">This blog article gives a practical introduction to how C# programs can be compiled into FPGA circuits using the Kiwi system developed by myself and David Greaves at the University of Cambridge Computer Lab. Our starting point will be a C# program developed inside Visual Studio 2010 for computing factorial: This program can be compiled and executed inside Visual Studio to report the factorial of 5 (i.e. 120). However, using our Kiwi system this program can also be converted into a Verilog circuit...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/10/15/compiling-c-programs-into-fpga-circuits-factorial-example.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10076471" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="high level synthesis" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/high+level+synthesis/" /><category term="FPGA" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/FPGA/" /><category term="hardware compilation" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/hardware+compilation/" /></entry><entry><title>F# Black-Scholes running on GPUs and SSE3 Multicore Processors using Accelerator</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/10/14/f-black-scholes-running-on-gpis-and-sse3-multicore-processors-using-accelerator.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/10/14/f-black-scholes-running-on-gpis-and-sse3-multicore-processors-using-accelerator.aspx</id><published>2010-10-14T09:05:23Z</published><updated>2010-10-14T09:05:23Z</updated><content type="html">The Accelerator library from Microsoft helps us write code which can execute on GPUs and multicore processors using SSE3 vector instructions. There is also an experimental FPGA target. To illustrate data-parallel programming in F# using Accelerator I show below an implementation of the Black-Scholes computation which is based on the sample from the CUDA SDK by Victor Podlozhnyuk at NVIDIA and we also draw inspiration from Geoff Mainland's Haskell reformulation of this sample. The objective of this...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/10/14/f-black-scholes-running-on-gpis-and-sse3-multicore-processors-using-accelerator.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10075764" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author><category term="GPGPU GPU option pricing multicore Accelerator" scheme="http://blogs.msdn.com/b/satnam_singh/archive/tags/GPGPU+GPU+option+pricing+multicore+Accelerator/" /></entry><entry><title>Kiwi Synthesis of C# and F# Combinational Circuit Models into FPGA Circuits</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/04/28/kiwi-synthesis-of-c-and-f-combinational-circuit-models-into-fpga-circuits.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/04/28/kiwi-synthesis-of-c-and-f-combinational-circuit-models-into-fpga-circuits.aspx</id><published>2010-04-28T16:02:30Z</published><updated>2010-04-28T16:02:30Z</updated><content type="html">The Kiwi project aims to automatically translate concurrent C# and F# programs into FPGA circuits for accelerated execution. I work with David Greaves at the University of Cambridge Computer Laboratory and we have a prototype system that consumes .NET bytecode and converts it into VHDL or Verilog circuit descriptions. Kiwi usually produces a sequential circuit from a multi-threaded C# program which typically implements a data-path or finite state machine. However, it would also be convenient to describe...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/04/28/kiwi-synthesis-of-c-and-f-combinational-circuit-models-into-fpga-circuits.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10003963" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>A C# implementation of a convolver using Accelerator for GPGPU and multicore targets using LINQ operators</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/01/11/a-c-implementation-of-a-convolver-using-accelerator-for-gpgpu-and-multicore-targets-using-linq-operators.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/01/11/a-c-implementation-of-a-convolver-using-accelerator-for-gpgpu-and-multicore-targets-using-linq-operators.aspx</id><published>2010-01-11T12:43:41Z</published><updated>2010-01-11T12:43:41Z</updated><content type="html">In a previous blog post I showed how a 2D convolver can be written in F# using Microsoft's Accelerator system for GPGPU and SIMD x64 multicore programming targets. This blog article explains how the same 2D convolver can also be nicely expressed in C# and it illustrates a few cool C# and LINQ features including type inference, extension methods, the indexed Select operator and the Aggregate operator. I also give a more old school C# implementation at the end of this blog article. First, here is the...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/01/11/a-c-implementation-of-a-convolver-using-accelerator-for-gpgpu-and-multicore-targets-using-linq-operators.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9946493" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>An F# Functional Geometry Description of Escher's Fish</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2010/01/06/an-f-functional-geometry-description-of-escher-s-fish.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2010/01/06/an-f-functional-geometry-description-of-escher-s-fish.aspx</id><published>2010-01-06T01:58:00Z</published><updated>2010-01-06T01:58:00Z</updated><content type="html">This blog explains how Escher 's fish wood carving can be expressed in F# using functional geometry which was first presented by Peter Henderson in 1982. This very functional and compositional style of describing pictures is nicely expressed in F# . Functional geometry provides us with a nice algebra for pictures which has been used by the author as the basis of a system for automatically computing the layout of digital circuits expressed in functional languages (e.g. Lava ). 
 
 First, here is...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2010/01/06/an-f-functional-geometry-description-of-escher-s-fish.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9944325" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Distracted by Abstraction - A poem about F#</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2009/12/25/distracted-by-abstraction-a-poem-about-f.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2009/12/25/distracted-by-abstraction-a-poem-about-f.aspx</id><published>2009-12-25T14:10:00Z</published><updated>2009-12-25T14:10:00Z</updated><content type="html">You infer the intent in my expression, Although not always without qualification. 
 My heart was torn between function and object, But you have rendered them as one. 
 I've always been lazy by nature, Yet I'm drawn to your conditional strictness. 
 I have emerged downcast from a haze of inheritance, To a higher order Nirvana. 
 Although by any unit of measure, You're not a principled type. 
 I yearn so deeply to functorize you, But you say that all you want is your own private namespace. 
...(&lt;a href="http://blogs.msdn.com/b/satnam_singh/archive/2009/12/25/distracted-by-abstraction-a-poem-about-f.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9941151" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>GPGPU and x64 Multicore Programming with Accelerator from F#</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/satnam_singh/archive/2009/12/15/gpgpu-and-x64-multicore-programming-with-accelerator-from-f.aspx" /><id>http://blogs.msdn.com/b/satnam_singh/archive/2009/12/15/gpgpu-and-x64-multicore-programming-with-accelerator-from-f.aspx</id><published>2009-12-15T13:50:00Z</published><updated>2009-12-15T13:50:00Z</updated><content type="html">&lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;Microsoft recently released a preview of the &lt;/span&gt;&lt;a href="https://connect.microsoft.com/acceleratorv2" mce_href="https://connect.microsoft.com/acceleratorv2"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-family: arial"&gt;&lt;font face="Calibri"&gt;Accelerator V2&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt; GPU and x64 multicore programming system on Microsoft Connect. This system provides a civilized level of abstraction for writing data-parallel programs that execute on GPUs and multicore processors. An experimental FPGA target is under development.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;Even on my low end graphics card I get pretty impressive performance results for the 2D convolver that is described in this blog. All 8 cores of my 64-bit Windows 7 workstation are also effectively exercised by the x64 multicore target, which exploits SIMD processor instructions and multithreading. I won't say anything about performance in this blog post since what I want to focus on is how to use Accelerator from the &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/fsharp" mce_href="http://msdn.microsoft.com/en-us/fsharp"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-family: arial"&gt;&lt;font color="#0000ff" face="Calibri"&gt;F#&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt; functional programming language. We will work backwards by starting off with a complete implementation of a two dimensional convolver. Step by step we show how this convolver is expressed using Accelerator from F#. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;First here is the beautiful implementation of a two dimensional convolver. The rest of this post explains why this code works.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; System&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; Microsoft.ParallelArrays&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;[&amp;lt;EntryPoint&amp;gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; main(args) = &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a filter kernel for the convolution&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; testKernel = Array.map float32 [| &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt; |] &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Specify the size of each dimension of the input array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; inputSize = &lt;span style="color: brown"&gt;10&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create a pseudo-random number generator&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; random = Random (&lt;span style="color: brown"&gt;42&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a psueduo-input data array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; testData = Array2D.init inputSize inputSize (&lt;span style="color: blue"&gt;fun&lt;/span&gt; i j &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; float32 (random.NextDouble() * &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;float (random.Next(&lt;span style="color: brown"&gt;1&lt;/span&gt;, &lt;span style="color: brown"&gt;100&lt;/span&gt;)))) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create an Accelerator float parallel array for the F# input array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; testArray = &lt;span style="color: blue"&gt;new&lt;/span&gt; FloatParallelArray(testData)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a function to convolve in the X or Y direction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; convolve (shifts : int &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; int []) (kernel : float32 []) i (a : FloatParallelArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * ParallelArrays.Shift(a, shifts i) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + convolve shifts kernel (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;) a&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a 2D convolver&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveXY kernel input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: green"&gt;// First convolve in the X direction and then in the Y direction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveX = convolve (&lt;span style="color: blue"&gt;fun&lt;/span&gt; i &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; [| -i; &lt;span style="color: brown"&gt;0&lt;/span&gt; |]) kernel (kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt;) input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveY = convolve (&lt;span style="color: blue"&gt;fun&lt;/span&gt; i &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; [| &lt;span style="color: brown"&gt;0&lt;/span&gt;; -i |]) kernel (kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt;) convolveX&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;convolveY&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create a DX9 target and use it to convolve the test input&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; dx9Target = &lt;span style="color: blue"&gt;new&lt;/span&gt; DX9Target()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveDX9 = dx9Target.ToArray2D (convolveXY testKernel testArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"DX9: -&amp;gt; \r\n%A"&lt;/span&gt; convolveDX9&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create a X64 multi-core target and use it to convolve the test input&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; x64MCTarget = &lt;span style="color: blue"&gt;new&lt;/span&gt; X64MulticoreTarget()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveMC = x64MCTarget.ToArray2D (convolveXY testKernel testArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"MC: -&amp;gt; \r\n%A"&lt;/span&gt; convolveMC&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: brown"&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-ascii-font-family: calibri; mso-hansi-font-family: calibri"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-ascii-font-family: calibri; mso-hansi-font-family: calibri"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This program sets up a pseudo-random two dimensional input array, declares a two dimensional convolver and then uses two of the targets supported by Accelerator to convolve the input array. The first target uses a GPU to perform the convolution and the second target uses multiple x64 processor cores and makes use of special SIMD instructions. When this program is run it produces the following output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-ascii-font-family: calibri; mso-hansi-font-family: calibri"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #1f497d; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid; padding-top: 1pt; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;DX9: -&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;[[4124.88916f; 4006.17432f; 3619.18579f; 4345.93262f; 6214.79004f; 7851.854f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6639.24854f; 6447.55664f; 4849.12109f; 5399.95215f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[3999.14282f; 3891.52783f; 3691.94263f; 4562.6543f; 6413.09766f; 7815.42236f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6846.51172f; 6543.7251f; 4950.29443f; 5539.11377f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[4643.48877f; 4448.87451f; 4293.98975f; 4958.56201f; 6505.2334f; 7420.50586f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7069.68311f; 6669.47803f; 5239.27148f; 5991.7793f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[5392.69336f; 5102.70215f; 4892.03027f; 5074.26025f; 5990.81055f; 6369.36475f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6808.10986f; 6476.23047f; 5292.99463f; 6154.81885f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[8989.50488f; 8397.94434f; 7150.7959f; 5570.37061f; 5170.64307f; 5217.95703f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6137.8042f; 6353.71484f; 5624.02979f; 6247.72852f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[12248.4824f; 11455.2373f; 9597.80078f; 6825.54688f; 5358.00586f; 4921.00293f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6604.14258f; 7520.95361f; 7361.63232f; 7363.42578f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[16833.0352f; 15605.6055f; 12528.748f; 8065.896f; 5745.88574f; 5093.6792f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7391.62354f; 9219.54004f; 9945.78711f; 9624.86328f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[13102.8984f; 12436.5234f; 10673.6123f; 7992.61035f; 6201.81299f; 5618.32861f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7226.84521f; 9439.95508f; 10573.7754f; 10420.5703f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[14555.6426f; 14135.1074f; 12600.9141f; 10219.6904f; 8211.8623f; 7361.39746f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7424.83643f; 9536.95605f; 10884.3418f; 10907.2549f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[10885.0293f; 11083.6436f; 11301.6055f; 11469.3613f; 10785.7178f; 10094.2041f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;9660.19238f; 11580.3281f; 12738.5098f; 12256.5371f]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;MC: -&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;[[4124.88965f; 4006.17529f; 3619.18652f; 4345.93311f; 6214.79053f; 7851.85449f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6639.24902f; 6447.55664f; 4849.12109f; 5399.95215f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[3999.14282f; 3891.52783f; 3691.94263f; 4562.6543f; 6413.09814f; 7815.42236f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6846.51172f; 6543.7251f; 4950.29443f; 5539.11377f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[4643.48877f; 4448.87451f; 4293.98975f; 4958.56201f; 6505.23389f; 7420.50586f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7069.68311f; 6669.47803f; 5239.27148f; 5991.7793f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[5392.69336f; 5102.70215f; 4892.03027f; 5074.26074f; 5990.81152f; 6369.36523f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6808.10986f; 6476.23047f; 5292.99463f; 6154.81934f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[8989.50488f; 8397.94434f; 7150.7959f; 5570.37061f; 5170.64307f; 5217.95752f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6137.80469f; 6353.71484f; 5624.03027f; 6247.72852f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[12248.4844f; 11455.2383f; 9597.80078f; 6825.54785f; 5358.00586f; 4921.00293f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;6604.14355f; 7520.95459f; 7361.63232f; 7363.42627f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[16833.0352f; 15605.6055f; 12528.748f; 8065.896f; 5745.88574f; 5093.67969f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7391.62354f; 9219.54004f; 9945.78906f; 9624.86328f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[13102.8984f; 12436.5234f; 10673.6133f; 7992.61084f; 6201.81348f; 5618.3291f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7226.84521f; 9439.95605f; 10573.7754f; 10420.5713f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[14555.6426f; 14135.1074f; 12600.916f; 10219.6914f; 8211.86328f; 7361.39795f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;7424.83643f; 9536.95703f; 10884.3418f; 10907.2559f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[10885.0293f; 11083.6445f; 11301.6074f; 11469.3633f; 10785.7188f; 10094.2051f;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="border-bottom: medium none; border-left: medium none; padding-bottom: 0cm; margin: 0cm 0cm 0pt; padding-left: 0cm; padding-right: 0cm; background: #1f497d; border-top: medium none; border-right: medium none; padding-top: 0cm; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Lucida Console'; color: white; font-size: 9pt; mso-bidi-font-family: calibri; mso-themecolor: background1"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;9660.19336f; 11580.3281f; 12738.5107f; 12256.5371f]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="mso-bidi-font-family: calibri; mso-ascii-font-family: calibri; mso-hansi-font-family: calibri"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;A convolver computes a weighted average around some point. Image editing programs typically have an operation that smoothes an image and this is usually performed by a two dimensional convolution around each pixel. We shall discuss how to implement a one dimensional (1D) convolver fist and then generalize this to a two dimensional (2D) convolver afterwards. A convolution in one dimension can be expressed as a weighted sum around each value in an input array (or stream):&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;img style="width: 182px; height: 92px" src="http://raintown.org/msdn/sigma.png" width="468" height="239" mce_src="http://raintown.org/msdn/sigma.png"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-align: center; margin: 0cm 0cm 0pt" class="MsoNormal" align="center"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt; mso-fareast-language: en-gb; mso-no-proof: yes"&gt;&lt;?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"&gt;&lt;/v:path&gt;&lt;o:lock v:ext="edit" aspectratio="t"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&lt;v:shape style="width: 133.5pt; height: 67.5pt; visibility: visible; mso-wrap-style: square" id="_x0000_i1030" type="#_x0000_t75" alt="fir_equation.jpg"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="fir_equation"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;Here is a concrete example of a one dimensional convolution of an eight element array &lt;b style="mso-bidi-font-weight: normal"&gt;x&lt;/b&gt; which is being convolved by a five element filter kernel &lt;b style="mso-bidi-font-weight: normal"&gt;a&lt;/b&gt; to produce an eight element result array &lt;b style="mso-bidi-font-weight: normal"&gt;y&lt;/b&gt;. The filter kernel &lt;b style="mso-bidi-font-weight: normal"&gt;a&lt;/b&gt; appears to be like a window which slides across each element of the input array. To simplify the explanation and code, the filter is placed to the left of the element being convolved. A more realistic convolver would centre the filter kernel over the element being convolved but that introduces some extra boundary condition code which I donÃ¢ÂÂt want to get bogged down with in this blog.&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&lt;img src="http://raintown.org/msdn/convolver_point.png" width="522" height="271" mce_src="http://raintown.org/msdn/convolver_point.png"&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="text-align: center; margin: 0cm 0cm 0pt" class="MsoNormal" align="center"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt; mso-fareast-language: en-gb; mso-no-proof: yes"&gt;&lt;v:shape style="width: 377.25pt; height: 184.5pt; visibility: visible; mso-wrap-style: square" id="_x0000_i1029" type="#_x0000_t75" alt="convolver_point.png"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png" o:title="convolver_point"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;We can implement a 1D software convolver in F# as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: consolas; color: blue; font-size: 9.5pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; clamp i (input : float32 [])&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: blue"&gt;if&lt;/span&gt; i &amp;lt; &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;input.[&lt;span style="color: brown"&gt;0&lt;/span&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;input.[i]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveAt i (kernel : float32 []) input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;= &lt;/font&gt;&lt;font face="Consolas"&gt;Array.sum [| &lt;span style="color: blue"&gt;for&lt;/span&gt; k &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: brown"&gt;0&lt;/span&gt; .. kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt; &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; clamp (i-k) input * kernel.[k] |]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; softwareConvolver kernel (input : float32 [])&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;=&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;[| &lt;span style="color: blue"&gt;for&lt;/span&gt; i &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: brown"&gt;0&lt;/span&gt; .. input.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt; &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; convolveAt i kernel input |]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;The &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;clamp&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;function has the following type which accepts an array index of type &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;int&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;and an array of &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;float32&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt; values and returns an element of the array or a clamped value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; clamp : int -&amp;gt; float32 [] -&amp;gt; float32&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;This function allows us to define values for negative array indices and works by returning the value of the first array element &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;input.[0]&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;whenever we try to compute a negative index of the &lt;/span&gt;&lt;font size="3" face="Calibri"&gt;input &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;array. Note that in F# arrays are indexed with the &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;.[...]&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt; notation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;The &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;convolveAt&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;function has the type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; convolveAt : int -&amp;gt; float32 [] -&amp;gt; float32 [] -&amp;gt; float32&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;and computes the convolution of a single position in the input array to produce the result at the corresponding output array. For example, the picture above illustrates the calculation of:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;convolveAt &lt;span style="color: brown"&gt;5&lt;/span&gt; [| &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt; |] [| &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;6&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt; |]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;Note that array literals in F# are written using &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;[| ... |]&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;brackets. The definition of &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;convolveAt&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;makes use of an array comprehension which allows us to specify an expression that defines the values of an array:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;[| &lt;span style="color: blue"&gt;for&lt;/span&gt; k &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: brown"&gt;0&lt;/span&gt; .. kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt; &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; clamp (i-k) input * kernel.[k] |]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;If the value of &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;kernel.Length&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;is 5 and if we are convolving at the first array index value of 0 for&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; &lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;i&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt; then this is equivalent to writing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;[| clamp (- &lt;span style="color: brown"&gt;4&lt;/span&gt;) input * kernel.[&lt;span style="color: brown"&gt;4&lt;/span&gt;] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;clamp (- &lt;span style="color: brown"&gt;3&lt;/span&gt;) input * kernel.[&lt;span style="color: brown"&gt;3&lt;/span&gt;] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;clamp (- &lt;span style="color: brown"&gt;2&lt;/span&gt;) input * kernel.[&lt;span style="color: brown"&gt;2&lt;/span&gt;] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;clamp (- &lt;span style="color: brown"&gt;1&lt;/span&gt;) input * kernel.[&lt;span style="color: brown"&gt;1&lt;/span&gt;] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;clamp&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: brown"&gt;0&lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;input * kernel.[&lt;span style="color: brown"&gt;0&lt;/span&gt;] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;|]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;The final step is to sum the elements of this array which is accomplished with a call to the &lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;Array.sum&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt; library function.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;We can also exploit an array comprehension to produce the completely convolved result array by applying the single point convolution function to every element of the array by using the software function which has the type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; softwareConvolver : float32 [] -&amp;gt; float32 [] -&amp;gt; float32 []&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;and the definition:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; softwareConvolver kernel (input : float32 [])&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;=&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;[| &lt;span style="color: blue"&gt;for&lt;/span&gt; i &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: brown"&gt;0&lt;/span&gt; .. input.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt; &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; convolveAt i kernel input |]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt" lang="EN-US"&gt;Although this code correctly implements a 1D convolver it is not an ideal starting point for a parallel implementation of convolution.&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt; To make an efficient implementation of the convolver for Accelerator we have to express the computation avoiding the manipulation of absolute array indices. Instead we should try to think in terms of whole array operations and relative array indices. The first step in this direction is to think about how to compute the whole result array &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; rather than how to compute an individual element &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[&lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt;]. That is, we wish to compute an array which has the following form:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;= [&lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[0], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[1], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[2], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[3], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[4], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[5], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[6], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[7]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Furthermore, we wish to define &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; using only whole array operations. To help spot how we should do this the equations for &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; are expanded:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[0] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[0] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-1]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-2] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-3] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-4]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[1] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[1] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[0]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-1] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-2] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-3]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[2] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[2] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[1]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[0] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-1] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-2]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[3] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[3] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[2]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[1] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[0] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[-1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[4] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[4] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[3]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[2] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[1] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[5] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[5] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[4]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[3] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[2] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[6] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[6] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[5]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[4] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[3] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[2]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt;[7] &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[7] + &lt;b style="mso-bidi-font-weight: normal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;a&lt;/span&gt;&lt;/i&gt;&lt;span style="color: #1f497d; mso-themecolor: text2"&gt;[1]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[6]&lt;/span&gt;&lt;/b&gt; + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[5] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[4] + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4]&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;[3]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;We need some way of expressing the result of &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; in terms of whole array operations on &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt; or &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt; or through the use of only relative indices i.e. we wish to avoid mentioning absolute indices. Notice that the computation above does have whole operations e.g. the second column on the left shows the whole of the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt; array (shifted left by one) is multiplied by the scalar value &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[1]. The pattern occurs across all four columns with each column corresponding to one of the five coefficients. In each column the corresponding scalar coefficient value is used to multiply a shifted version of the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt; input. This observation allows us to express the value of &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; using only whole array operations on &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt; and its shifted counterparts. The calculations below represent the x and y arrays as a vector. The multiplication corresponds to the multiplication of a vector by a scalar value. The addition corresponds to the addition of two vectors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;y &lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= [&lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[0], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[1], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[2], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[3], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[4], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[5], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[6], &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;[7]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= a[0] * [x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]] +&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a[1] * [x[-1], x[0], x[1], x[2], x[3], x[4], x[5], x[6]] +&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a[2] * [x[-2], x[-1], x[0], x[1], x[2], x[3], x[4], x[5]] +&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a[3] * [x[-3], x[-2], x[-1], x[0], x[1], x[2], x[3], x[4]] +&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a[4] * [x[-4], x[-3], x[-2], x[-1], x[0], x[1], x[2], x[3]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This representation is an improvement from the original representation because it contains &lt;b style="mso-bidi-font-weight: normal"&gt;vector&lt;/b&gt; multiplications and &lt;b style="mso-bidi-font-weight: normal"&gt;vector&lt;/b&gt; additions which can be performed in parallel. The original formulation contained multiplications of scalar values (i.e. an element of the coefficient array) by scalar values (e.g. an element of the input array). This representation is not directly amenable to a parallel implementation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;To make the nature of the data-parallel operation shown above clearer we introduce the shift operator which takes as input an array and an amount to shift by &lt;i style="mso-bidi-font-style: normal"&gt;N&lt;/i&gt; and returns an array of the same size except all the elements are shifted up by the specified number of positions. The first &lt;i style="mso-bidi-font-style: normal"&gt;N&lt;/i&gt; elements of the result array are clamped by filling them with the first element of the input array. Here are some examples of shifts:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, 0) = [7, 2, 5, 9, 3, 8, 6, 4] = &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, -1) = [7, 7, 2, 5, 9, 3, 8, 6]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, -2) = [7, 7, 7, 2, 5, 9, 3, 8]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Using the shift operator we can re-express &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt; as:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-US"&gt;y&lt;/span&gt;&lt;/i&gt;&lt;span lang="EN-US"&gt; = &lt;span style="mso-tab-count: 1"&gt;&lt;/span&gt;&lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[0] * shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, 0) + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[1] * shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;-1) + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[2] * shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, -2) + &lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[3] * shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;,&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;-3) + &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i style="mso-bidi-font-style: normal"&gt;a&lt;/i&gt;[4] * shift (&lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;, -4)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This leads to a data-parallel implementation which can perform each coefficient multiplication in parallel with the others followed by a sum in parallel. These parallel operations are described in the following figure.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;o:p&gt;&lt;img style="width: 584px; height: 100px" src="http://raintown.org/msdn/convolver_accelerator.png" width="584" height="100" mce_src="http://raintown.org/msdn/convolver_accelerator.png"&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-fareast-language: en-gb; mso-no-proof: yes; mso-ansi-language: en-gb"&gt;&lt;v:shape style="width: 448.5pt; height: 81.75pt; visibility: visible; mso-wrap-style: square" id="Picture_x0020_5" type="#_x0000_t75" alt="convolver_accelerator.png" o:spid="_x0000_i1028"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png" o:title="convolver_accelerator"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Each blue arrow in this picture corresponds to a data-parallel operation. &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;The F# program below shows how to implement this 1D convolution using both the DX9 GPU target and the x64 SIMD multi-core target.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; System&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; Microsoft.ParallelArrays&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;[&amp;lt;EntryPoint&amp;gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; main(args) = &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare an input data array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; inputData = Array.map float32 [| &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;6&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt; |] &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare filter kernel for the convolution&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; kernel = Array.map float32 [| &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt; |] &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; kernelSize = Array.length kernel &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create an Accelerator float parallel array for the F# input array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; inputArray = &lt;span style="color: blue"&gt;new&lt;/span&gt; FloatParallelArray(inputData)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Build the expression&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; expr i = &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ParallelArrays.Shift(inputArray, -i) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + expr (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create DX9 target and compute result&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; dx9Target = &lt;span style="color: blue"&gt;new&lt;/span&gt; DX9Target()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; resDX = dx9Target.ToArray1D(expr (kernelSize-&lt;span style="color: brown"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"DX9&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt; \r\n%A"&lt;/span&gt; resDX&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create X64 multi-core target and compute result&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; mc64Target = &lt;span style="color: blue"&gt;new&lt;/span&gt; X64MulticoreTarget()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; resMC = mc64Target.ToArray1D(expr (kernelSize-&lt;span style="color: brown"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"X64MC --&amp;gt; \r\n%A"&lt;/span&gt; resMC&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: brown"&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;br&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;When run this produces the expected output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #1f497d; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid; padding-top: 1pt; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;DX9&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;[|147.0f; 137.0f; 118.0f; 106.0f; 115.0f; 120.0f; 124.0f; 133.0f|]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;X64MC --&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;[|147.0f; 137.0f; 118.0f; 106.0f; 115.0f; 120.0f; 124.0f; 133.0f|]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;To use an Accelerator target the input data must be created for an Accelerator data-parallel array. Typically the data represented by these arrays will be held in some memory specified by the target implementation. For example, for the DX9 GPU target the input values will be copied to memory on your graphics card. Accelerator provides several methods for creating data parallel arrays and here we create a floating point data-parallel array using a constructor:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-size: 12pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;font face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue"&gt;new&lt;/span&gt; :: float32 [] -&amp;gt; FloatParallelArray&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;&lt;font size="3" face="Calibri"&gt;and the type of &lt;/font&gt;&lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;&lt;font face="Consolas"&gt;inputArray&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span lang="EN-US"&gt; &lt;/span&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;is&lt;/span&gt; &lt;/font&gt;&lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;&lt;font face="Consolas"&gt;FloatParallelArray&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;&lt;font size="3" face="Calibri"&gt;In your F# program you should think of a &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9.5pt" lang="EN-US"&gt;FloatParallelArray&lt;/span&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;&lt;font size="3" face="Calibri"&gt; as being a reference or a handle to some real array somewhere else. When you write computations over values of type &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9.5pt" lang="EN-US"&gt;FloatParallelArray&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;what you are really doing is building up a symbolic expression tree that represents the computation that you want. When you try to evaluate such an expression the Accelerator system JITs (e.g. to GPU code via DX9) to produce the actual code for performing your computation and executes it with the data in the input data-parallel arrays and transmits the result back to your F# program.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Accelerator provides a library of data-parallel arrays and data-parallel operations over its data-parallel arrays. To perform a data-parallel multiplication of a data-parallel array by a single kernel coefficient &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;we use one of AcceleratorÃ¢ÂÂs data-parallel multiplication operations (there are many other overloads):&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; (*) : FloatParallelArray -&amp;gt; FloatParallelArray -&amp;gt; FloatParallelArray&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: en-gb; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This does not immediately perform the multiplication. What is really happening is that an expression tree is built up with a multiplication node in it. However, the JIT-ing nature of the Accelerator implementation almost makes it looks like the code is being executed immediately.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3" face="Calibri"&gt;The addition operation used in the 1D convolver is also a data-parallel addition over &lt;/font&gt;&lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;&lt;font face="Consolas"&gt;FloatParallelArray&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;s:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; (+) : FloatParallelArray -&amp;gt; FloatParallelArray -&amp;gt; FloatParallelArray&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3" face="Calibri"&gt;Finally, the shift operation here works over one dimensional arrays of type &lt;/font&gt;&lt;/span&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;&lt;font face="Consolas"&gt;FloatParallelArray&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt; and takes just one number which specified how much to shift by:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; ParallelArrays.Shift&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;: FloatParallelArray -&amp;gt; int -&amp;gt; FloatParallelArray&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;a title="_Toc248291067" name="_Toc248291067"&gt;&lt;/a&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;We may be tempted to specify the overall expression for the convolver by writing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolver1D kernel input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;= List.fold &lt;span style="color: brown"&gt;0&lt;/span&gt; [ &lt;span style="color: blue"&gt;for&lt;/span&gt; k &lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: brown"&gt;0&lt;/span&gt; .. kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; kernel.[i] * &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;ParallelArrays.Shift(inputArray, -i) ]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font size="3" face="Calibri"&gt;and how nice that would be but sadly we donÃ¢ÂÂt have a proper &lt;/font&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;0&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="color: brown"&gt; &lt;/span&gt;yet so instead we write a recursive formulation:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Build the expression&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; expr i = &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ParallelArrays.Shift(inputArray, -i) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + expr (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font size="3" face="Calibri"&gt;where &lt;/font&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;expr&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt; has the type:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; expr : int -&amp;gt; FloatParallelArray&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3" face="Calibri"&gt;Given the index of the highest element in the kernel this function builds up an expression which computes the 1D&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;convolution. This expression is used to call the DX9 GPU target to perform the computation and retrieve the result &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;&lt;font face="Consolas"&gt;resDX&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3" face="Calibri"&gt; &lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;which has the type &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt" lang="EN-US"&gt;float32&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;span style="font-family: consolas; font-size: 9.5pt" lang="EN-US"&gt; []:&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create DX9 target and compute result&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; dx9Target = &lt;span style="color: blue"&gt;new&lt;/span&gt; DX9Target()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; resDX = dx9Target.ToArray1D(expr (kernelSize-&lt;span style="color: brown"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"DX9&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt; \r\n%A"&lt;/span&gt; resDX&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;A target only needs to be created once. The first time a target is created for DX9 there is a delay while the system is initialized. For benchmarking it is a good idea to perform a dummy computation first to Ã¢ÂÂwarm upÃ¢ÂÂ the system.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="mso-bookmark: _toc248291067"&gt;&lt;/span&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The previous example convolved a one dimensional (1D) matrix. In this section we show how we can convolve a 2D matrix by applying the convolution independently to each line. This computation is illustrated in the diagram below for the following array of arrays:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[|[|&lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;6&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt; |]; &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;[|&lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt; |]|]&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="font-family: 'Courier New'; font-size: 8pt; mso-no-proof: yes; mso-ansi-language: en-gb; mso-bidi-font-size: 10.0pt"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-fareast-language: en-gb; mso-no-proof: yes; mso-ansi-language: en-gb"&gt;&lt;v:shape style="width: 434.25pt; height: 246pt; visibility: visible; mso-wrap-style: square" id="Picture_x0020_1" type="#_x0000_t75" alt="convolver_accelerator1d2d.png" o:spid="_x0000_i1027"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image006.png" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image006.png" o:title="convolver_accelerator1d2d"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&amp;nbsp;&lt;img style="width: 649px; height: 366px" src="http://raintown.org/msdn/convolver_accelerator1d2d.png" width="649" height="366" mce_src="http://raintown.org/msdn/convolver_accelerator1d2d.png"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;An F# version of a 1D convolution of 2D input data is s&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;hown below which illustrates convolution in the X and Y directions (independently).&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; System&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; System&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;open&lt;/span&gt; Microsoft.ParallelArrays&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;[&amp;lt;EntryPoint&amp;gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; main(args) = &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare an input data array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; inputData &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= Array2D.map float32 (array2D [ [ &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;6&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt; ];&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[ &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;8&lt;/span&gt;; &lt;span style="color: brown"&gt;9&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt; ] ])&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare filter kernel for the convolution&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; kernel : = Array.map float32 [| &lt;span style="color: brown"&gt;2&lt;/span&gt;; &lt;span style="color: brown"&gt;5&lt;/span&gt;; &lt;span style="color: brown"&gt;7&lt;/span&gt;; &lt;span style="color: brown"&gt;4&lt;/span&gt;; &lt;span style="color: brown"&gt;3&lt;/span&gt; |] ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; kernelSize = kernel.Length&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create an Accelerator float parallel array for the F# input array&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; inputArray = &lt;span style="color: blue"&gt;new&lt;/span&gt; FloatParallelArray(inputData)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Build the expression to convolve in the Y direction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; exprY i = &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ParallelArrays.Shift(inputArray, [| &lt;span style="color: brown"&gt;0&lt;/span&gt;; -i |]) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + exprY (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create DX9 target and compute result&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; dx9Target = &lt;span style="color: blue"&gt;new&lt;/span&gt; DX9Target()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; resDXY = dx9Target.ToArray2D(exprY (kernelSize-&lt;span style="color: brown"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"DX9 Y-dir&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt; \r\n%A"&lt;/span&gt; resDXY&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Build the expression to convolve in the X direction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; exprX i = &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] *&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;ParallelArrays.Shift(inputArray, [| -i; &lt;span style="color: brown"&gt;0&lt;/span&gt; |]) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + exprX (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; resDXY = dx9Target.ToArray2D(exprX (kernelSize-&lt;span style="color: brown"&gt;1&lt;/span&gt;))&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"DX9 X-dir&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt; \r\n%A"&lt;/span&gt; resDXY&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: brown"&gt;0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;When run, this code computes the correct values:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #1f497d; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid; padding-top: 1pt; mso-background-themecolor: text2; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;$ convolver_fs_1d_of_2d_input.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;DX9 Y-dir&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;[[147.0f; 137.0f; 118.0f; 106.0f; 115.0f; 120.0f; 124.0f; 133.0f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[42.0f; 54.0f; 82.0f; 113.0f; 123.0f; 138.0f; 144.0f; 132.0f]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;DX9 X-dir&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;--&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;[[147.0f; 42.0f; 105.0f; 189.0f; 63.0f; 168.0f; 126.0f; 84.0f]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="ConsoleOutput"&gt;&lt;font color="#ffffff"&gt;&lt;font face="Lucida Console"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;[137.0f; 54.0f; 109.0f; 179.0f; 73.0f; 170.0f; 120.0f; 86.0f]]&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;a title="_Toc248291068" name="_Toc248291068"&gt;&lt;/a&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Although this code performs multiplication, shifting and adding of arrays as we saw before in this case we use a different overloaded functions that work over two dimensional arrays and the shift operation uses a two element array to specify how much to shift by in each direction.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;span style="mso-bookmark: _toc248291068"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;val&lt;/span&gt; ParallelArrays.Shift&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;: FloatParallelArray -&amp;gt; int [] -&amp;gt; FloatParallelArray&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span style="mso-bookmark: _toc248291068"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="mso-bookmark: _toc248291068"&gt;&lt;/span&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;We can make a two dimensional convolver by first convolving in the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;-direction and then convolving in the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction. Or we can perform a convolution in the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction and then in the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;-direction. To convolve a 2D matrix we need to use a version of the shift operator which takes two arguments which describe how much to shift by in each dimension. Shifting just in the&lt;i style="mso-bidi-font-style: normal"&gt; x&lt;/i&gt;-direction is illustrated in the diagram below.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;o:p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/satnam_singh/WindowsLiveWriter/GPGPUandx64MulticoreProgrammingwithAccel_A200/shift_2d_x_dir_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="shift_2d_x_dir" border="0" alt="shift_2d_x_dir" src="http://blogs.msdn.com/blogfiles/satnam_singh/WindowsLiveWriter/GPGPUandx64MulticoreProgrammingwithAccel_A200/shift_2d_x_dir_thumb.png" width="688" height="278"&gt;&lt;/a&gt; &lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-fareast-language: en-gb; mso-no-proof: yes; mso-ansi-language: en-gb"&gt;&lt;v:shape style="width: 451.5pt; height: 182.25pt; visibility: visible; mso-wrap-style: square" id="Picture_x0020_2" type="#_x0000_t75" alt="shift_2d_x_dir.png" o:spid="_x0000_i1026"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image008.png" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image008.png" o:title="shift_2d_x_dir"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;A function which shifts a 2D array just in the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;-direction could be written as:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; convolveXDir (kernel : float32 []) i (a : FloatParallelArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * ParallelArrays.Shift(a, [| -i; 0 |]) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + convolveXDir kernel (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;) a&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This function captures the shifting right along the rows nature of the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;-direction convolution by specifying a shift of &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt; elements along the rows for the &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt;-th iteration (but it never shifts down columns hence the value of 0 in the second element of the array literal).&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Shifting in the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction is illustrated in the diagram below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;span style="mso-fareast-language: en-gb; mso-no-proof: yes; mso-ansi-language: en-gb"&gt;&lt;v:shape style="width: 451.5pt; height: 184.5pt; visibility: visible; mso-wrap-style: square" id="Picture_x0020_3" type="#_x0000_t75" alt="shift_2d_y_dir.png" o:spid="_x0000_i1025"&gt;&lt;v:imagedata mce_src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image010.png" src="file:///C:\Users\satnams\AppData\Local\Temp\msohtmlclip1\01\clip_image010.png" o:title="shift_2d_y_dir"&gt;&lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;img style="width: 667px; height: 271px" src="http://raintown.org/msdn/shift_2d_y_dir.png" width="667" height="271" mce_src="http://raintown.org/msdn/shift_2d_y_dir.png"&gt;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;A function which shifts a 2D array just in the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction could be written as:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; convolveYDir (kernel : float32 []) i (a : FloatParallelArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * ParallelArrays.Shift(a, [| 0; -i |]) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + convolveYDir kernel (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;) a&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;This function captures the shifting down along the columns of the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction convolution by specifying a shift of &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt; elements along the columns for the &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt;-th iteration (but it never shifts along rows hence the value of 0 in the first element of the array literal).&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Rather than define two separate functions for convolving in the X and Y directions we can define just one function and pass a higher order function which allows us to abstract the direction of convolution. &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a function to convolve in the X or Y direction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; &lt;span style="color: blue"&gt;rec&lt;/span&gt; convolve (shifts : int &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; int []) (kernel : float32 []) i (a : FloatParallelArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= &lt;span style="color: blue"&gt;let&lt;/span&gt; e = kernel.[i] * ParallelArrays.Shift(a, shifts i) &lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; i = &lt;span style="color: brown"&gt;0&lt;/span&gt; &lt;span style="color: blue"&gt;then&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;e + convolve shifts kernel (i-&lt;span style="color: brown"&gt;1&lt;/span&gt;) a&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;o:p&gt;&lt;font face="Consolas"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Declare a 2D convolver&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveXY kernel input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;= // First convolve in the X direction and then in the Y direction&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveX = convolve (&lt;span style="color: blue"&gt;fun&lt;/span&gt; i &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; [| -i; &lt;span style="color: brown"&gt;0&lt;/span&gt; |]) kernel (kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt;) input&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveY = convolve (&lt;span style="color: blue"&gt;fun&lt;/span&gt; i &lt;span style="color: blue"&gt;-&amp;gt;&lt;/span&gt; [| &lt;span style="color: brown"&gt;0&lt;/span&gt;; -i |]) kernel (kernel.Length - &lt;span style="color: brown"&gt;1&lt;/span&gt;) convolveX&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;convolveY&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 8pt" class="MsoBodyText"&gt;&lt;span lang="EN-US"&gt;&lt;font size="3" face="Calibri"&gt;Note that the convolution function takes a higher order parameter which specifies the shift direction. To convolve in the &lt;i style="mso-bidi-font-style: normal"&gt;x&lt;/i&gt;-direction we provide a function which is given the degree to shift by &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt; and return the (&lt;i style="mso-bidi-font-style: normal"&gt;dx&lt;/i&gt;, &lt;i style="mso-bidi-font-style: normal"&gt;dy&lt;/i&gt;) shift to be applied to the data parallel array i.e. (-&lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt;, 0). To shift in the &lt;i style="mso-bidi-font-style: normal"&gt;y&lt;/i&gt;-direction we provide another function which is given the degree to shift by &lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt; and return the (&lt;i style="mso-bidi-font-style: normal"&gt;dx&lt;/i&gt;, &lt;i style="mso-bidi-font-style: normal"&gt;dy&lt;/i&gt;) shift to be applied to the data parallel array i.e. (0, -&lt;i style="mso-bidi-font-style: normal"&gt;i&lt;/i&gt;). We use lambda expressions to defines these functions anonymously (in-line) as arguments to the &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: consolas; font-size: 9.5pt" lang="EN-US"&gt;convolve &lt;/span&gt;&lt;span lang="EN-US"&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;function.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;To run the 2D F# convolver please follow these steps.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Install &lt;/font&gt;&lt;a href="https://connect.microsoft.com/acceleratorv2" mce_href="https://connect.microsoft.com/acceleratorv2"&gt;&lt;span style="font-size: 10pt; mso-bidi-font-family: arial"&gt;&lt;font face="Calibri"&gt;Accelerator V2&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;Create a new F# console project and paste in the 2D convolver code at the start of this blog.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;If you are not running a 64-bit operating system please remove the code for using the x64 multi-core target i.e. delete the lines:&lt;br style="mso-special-character: line-break"&gt;&lt;br style="mso-special-character: line-break"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green"&gt;// Create a X64 multi-core target and use it to convolve the test input&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;use&lt;/span&gt; x64MCTarget = &lt;span style="color: blue"&gt;new&lt;/span&gt; X64MulticoreTarget()&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;let&lt;/span&gt; convolveMC = x64MCTarget.ToArray2D (convolveXY testKernel testArray)&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="CodeSample"&gt;&lt;font face="Consolas"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;printfn &lt;span style="color: maroon"&gt;"MC: -&amp;gt; \r\n%A"&lt;/span&gt; convolveMC&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt 36pt" class="MsoListParagraphCxSpFirst"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Add a reference to &lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;System.Drawing&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; and the managed &lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;Microsoft.Accelerator.dll&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; (under the appropriate directory for your target e.g. &lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;C:\Program Files (x86)\Microsoft\Accelerator v2\bin\Managed\Release\Microsoft.Accelerator.dll&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;Build under Visual Studio.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Make sure that you have the right &lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;Accelerator.dll&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; in your path for your platform and target e.g&lt;/font&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;&lt;font face="Consolas"&gt;. C:\Program Files (x86)\Microsoft\Accelerator v2\bin\x64\Release\Accelerator.dll&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt; or make sure to have a copy of this file in your build directory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family: symbol; mso-bidi-font-family: symbol; mso-fareast-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&lt;font size="3"&gt;·&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Run the generated EXE from the build directory e.g. &lt;/font&gt;&lt;font face="Consolas"&gt;&lt;span class="CodeTextChar"&gt;&lt;span style="font-size: 9.5pt"&gt;bin/Release&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;If you want to use Accelerator code from inside F# Interactive you will need to reference the Accelerator library e.g.:&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;div style="border-bottom: windowtext 1pt dashed; border-left: windowtext 1pt dashed; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; background: #f2f2f2; border-top: windowtext 1pt dashed; border-right: windowtext 1pt dashed; padding-top: 1pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-border-alt: dash-small-gap windowtext .5pt; mso-element: para-border-div"&gt; &lt;p style="margin: 0cm 0cm 0pt; background: #f2f2f2; mso-background-themecolor: background1; mso-background-themeshade: 242" class="CodeSample"&gt;&lt;font face="Consolas"&gt;#r @"C:\Program Files (x86)\Microsoft\Accelerator v2\bin\Managed\Release\Microsoft.Accelerator.dll";;&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/p&gt;&lt;/div&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;a title="_GoBack" name="_GoBack"&gt;&lt;/a&gt;&lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;The Accelerator system encourages you to express data-parallel algorithms in terms of whole array operations which leads to efficient implementations for various back ends (targets). For example, the discipline of using only whole array operations allows me to make efficient address generator circuits for an experimental FPGA target that I am working on. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;Accelerator is quite well suited for writing &lt;a href="http://en.wikipedia.org/wiki/Stencil_(numerical_analysis)" mce_href="http://en.wikipedia.org/wiki/Stencil_(numerical_analysis)"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;&lt;font color="#0000ff"&gt;stencil-style&lt;/font&gt;&lt;/span&gt;&lt;/a&gt; data parallel programs. The expression orientated nature of Accelerator computations make them a nice fit for a functional language like F#. In effect the Accelerator system manifests itself as a domain specific language in F#, C# and C++ (as well as other .NET languages). &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The F# code in this blog was written with the participation of &lt;span style="mso-ansi-language: en-us" lang="EN-US"&gt;Lubomir Litchev and James Margetson. Thank you Lubo and James! I aslo recommend this article on using Accelerator from F#: &lt;a href="http://tomasp.net/blog/accelerator-intro.aspx"&gt;http://tomasp.net/blog/accelerator-intro.aspx&lt;/a&gt;.&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;The Accelerator system is still a research incubation project and the preview release is designed to solicit feedback. You can email &lt;span style="color: black"&gt;&lt;a href="mailto:msraccel@microsoft.com" mce_href="mailto:msraccel@microsoft.com"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;&lt;font color="#0000ff"&gt;msraccel@microsoft.com&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black"&gt;&lt;font size="3"&gt; &lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt"&gt;or use the Microsoft Connect &lt;a href="https://connect.microsoft.com/acceleratorv2/Feedback" mce_href="https://connect.microsoft.com/acceleratorv2/Feedback"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;Feedback Form&lt;/span&gt;&lt;/a&gt;. Thank you!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt"&gt;Satnam Singh&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; color: black; font-size: 10pt"&gt;&lt;a href="http://research.microsoft.com/~satnams" mce_href="http://research.microsoft.com/~satnams"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; mso-bidi-font-family: arial; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;&lt;font color="#0000ff"&gt;http://research.microsoft.com/~satnams&lt;/font&gt;&lt;/span&gt;&lt;/a&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0cm 0cm 0pt" class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937039" width="1" height="1"&gt;</content><author><name>satnam</name><uri>http://blogs.msdn.com/satnam/ProfileUrlRedirect.ashx</uri></author></entry></feed>