<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The ILNumerics Blog &#187; Scientific Computing</title>
	<atom:link href="https://ilnumerics.net/blog/category/scientific-computing/feed/" rel="self" type="application/rss+xml" />
	<link>https://ilnumerics.net/blog</link>
	<description>The Productivity Machine  &#124;  A fresh attempt for scientific computing  &#124;  http://ilnumerics.net</description>
	<lastBuildDate>Thu, 05 Dec 2024 09:09:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>ILNumerics: High Performance as Default</title>
		<link>https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/#comments</comments>
		<pubDate>Mon, 01 Apr 2024 11:25:09 +0000</pubDate>
		<dc:creator><![CDATA[haymo]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[accelerator]]></category>
		<category><![CDATA[autonomous]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[parallel]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[v7]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=1091</guid>
		<description><![CDATA[<p>ILNumerics releases Version 7.0 The ILNumerics team is proud and excited to announce the availability of a new major release of its ILNumerics Ultimate VS product line. This milestone represents a significant advancement in compiler technology: it introduces the first autonomously parallelizing array compiler, ILNumerics Accelerator. Array codes, such as numpy and Matlab, are popular within &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics: High Performance as Default</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/">ILNumerics: High Performance as Default</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>ILNumerics releases Version 7.0</h2>
<p>The ILNumerics team is proud and excited to announce the availability of a new major release of its ILNumerics Ultimate VS product line. This milestone represents a significant advancement in compiler technology: it introduces the first autonomously parallelizing array compiler, ILNumerics Accelerator.</p>
<p>Array codes, such as numpy and Matlab, are popular within the scientific community. They simplify the description of complex numerical algorithms. However, when these numerical codes are implemented into industrial-grade products, distributed to customers, and maintained by a larger development team for many years, existing tools reveal considerable limitations, with execution speed being possibly the greatest limitation.</p>
<p>ILNumerics Accelerator is here to resolve this issue once and for all. Built on the convenient language of ILNumerics Computing Engine for authoring scientific array codes directly in C# /.NET, our intelligent Accelerator compiler reformulates array codes and executes them in the most efficient manner, unguided and autonomously.</p>
<h2>Short Dive: Building an Array Compiler &#8230;</h2>
<p>The key to optimal hardware utilization today is, of course, the ability to efficiently parallelize the workload. Therefore, ILNumerics Accelerator compiler automatically detects and utilizes parallel potential within subsequent array instructions of your algorithm.</p>
<p>The prevalent approach to automatic parallelization today involves analyzing your code to detect instructions that can execute in parallel. The code is then rewritten to allow these independent instructions to run concurrently. This approach originated at a time when C/C++ and FORTRAN were considered &#8216;high-level&#8217; languages. While these languages offer some basic array support, numerical algorithms written in them inherently deal with <em>scalar</em> data.</p>
<p>In contrast, the algorithms we handle use n-dimensional arrays as the fundamental data type. When striving for real efficiency, the arrays&#8217; complexity prohibits any compile-time decision about data independence, a suitable execution device, or a low-level implementation using vector instructions, among other factors. Too many variables determine the optimal execution strategy, and their variation is too extensive to identify at development time.</p>
<h2>&#8230; with a fresh Approach to Parallelization &#8230;</h2>
<p>ILNumerics takes a data-driven approach to parallelization, making all crucial decisions &#8216;just in time&#8217; at <em>runtime</em>. This method enables us to implement the low-level internals of array instructions efficiently and eliminates the need for expensive dependency analysis of large program segments. It&#8217;s easier to determine at runtime whether an instruction relies on other data and when that data will be available.</p>
<p>However, this increases the compiler&#8217;s complexity significantly. Instead of producing fixed code for an array instruction found in the original program, we now generate an intermediate program, often representing several subsequent array instructions. This intermediate program is then transformed at runtime to reflect the original instructions in a manner that respects all influencing factors and enables optimal efficiency.</p>
<h2>&#8230; with Intelligence and Freedom</h2>
<p>These programs all run asynchronously, scheduling themselves onto suitable devices for execution at runtime. They connect with previous and subsequent asynchronous neighbors on the fly, even as they progress in calculating results. They autonomously determine the optimal implementation on the device they select. Significant decision-making power comes with immense responsibility. The final program code builds up asynchronously and autonomously at runtime.</p>
<p>Executing the same code branch twice may result in very different machine instructions. As the creators of the compiler, we can&#8217;t predict many details of the final implementation. We can&#8217;t even forecast the actual number of asynchronous programs, which we refer to as segments, executing concurrently. The decision now rests with the computer. It has a better understanding of the situation than we do and can process information and make educated decisions much faster and more effectively.</p>
<h2>Why another Beta, then?</h2>
<p>The first autonomous array compiler has arrived. Are you eager to try it out? Great! <a title="Getting Started: ILNumerics Accelerator" href="https://ilnumerics.net/accelerate-sum-examples.html" target="_blank">Go ahead and test</a> the current beta from nuget.org. Its performance is genuinely impressive.</p>
<p>The majority of our users are building industrial products and have chosen ILNumerics for its reliability and seamless integration into .NET (which means all of .NET, since 2005). The compiler will become a regular part of the ILNumerics Computing Engine once it&#8217;s ready. Currently, it&#8217;s like a young child, learning new things each day. It&#8217;s learning to walk and talk, occasionally stumbling over previously unknown obstacles. Sometimes, it even surprises its creators with unexpected efficiency.</p>
<p>With recent advancements, the Accelerator compiler is now set to &#8216;always on&#8217; mode. This marks a significant milestone in the development of a compiler. It&#8217;s now trusted to be stable and flexible enough to handle all codes, even unseen ones, ensuring it produces correct results and serves its primary purpose: to enhance efficiency.</p>
<p>The compiler will continue to <a title="Roadmap: ILNumerics Accelerator Compiler" href="https://ilnumerics.net/roadmap.html" target="_blank">develop</a> until the final release. It will become more <a title="State if the Art: Progressing Development of Accelerator Compiler" href="https://ilnumerics.net/accelerator-limitations.html" target="_blank">stable</a> and gain more real-world exposure. We would greatly appreciate if your feedback contributes to its maturity by then.</p>
<p>All previous modules of ILNumerics have been adapted for the new Accelerator. They are thoroughly tested, have undergone many <a title="ILNumerics Changelog" href="https://ilnumerics.net/changelog.html">bugfixes and improvements</a>, and are available for production on nuget.org as of today.</p>
<hr />
<p>&nbsp;</p>
<p>Introducing the ILNumerics Accelerator:</p>
<div style="width: 474px; " class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-1091-1" width="474" height="267" preload="metadata" controls="controls"><source type="video/mp4" src="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4?_=1" /><a href="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4">https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4</a></video></div>
<p>[ Video does not show? Download here: <a href="/media/andere/ILNumerics_Segments_2022.mp4">https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4</a> ]</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/">ILNumerics: High Performance as Default</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-high-performance-as-default/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4" length="1709355" type="video/mp4" />
		</item>
		<item>
		<title>ILNumerics Accelerator – A better Approach to faster Array Codes, Part II</title>
		<link>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/#comments</comments>
		<pubDate>Tue, 08 Nov 2022 22:51:29 +0000</pubDate>
		<dc:creator><![CDATA[haymo]]></dc:creator>
				<category><![CDATA[Accelerator]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[HPC]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Numerical Algorithms]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[accelerator]]></category>
		<category><![CDATA[hpc]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=1064</guid>
		<description><![CDATA[<p>An better Approach to an unsolved Problem TLDR: Authoring fast numerical array codes on .NET is a complex task. ILNumerics Computing Engine simplifies this task: it brings a convenient syntax, which is fully compatible to numpy and Matlab. And today, we bring back the free lunch: our brand new JIT compiler not only transforms numerical &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics Accelerator – A better Approach to faster Array Codes, Part II</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/">ILNumerics Accelerator – A better Approach to faster Array Codes, Part II</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>An better Approach to an unsolved Problem</h2>
<p style="font-size: +1.1em;margin-bottom: 12pt;text-align: justify"><em>TLDR: Authoring fast numerical array codes on .NET is a complex task. ILNumerics Computing Engine simplifies this task: it brings a convenient syntax, which is fully compatible to numpy and Matlab. And today, we bring back <a href="http://www.gotw.ca/publications/concurrency-ddj.htm" target="_blank">the free lunch</a>: our brand new JIT compiler not only transforms numerical algorithms into highly efficient codes, it also automatically adopts to and parallelizes your workload on any hardware found at runtime. It segments and distributes even small workloads efficiently &#8211; more fine grained than any manual configuration could do. </em></p>
<p style="text-align: right">Author: H. Kutschbach (ILNumerics)  Reading time: 12 min</p>
<p>Since its introduction in 2007 ILNumerics has led innovation for technical computing in the .NET world. We have enabled a short, expressive syntax for authors of numerical algorithms. Writing array based algorithms with ILNumerics feels very similar (and is compatible) to well known prototyping systems, namely: Matlab, numpy and all its successors.</p>
<p>Another focus of ILNumerics has always been: performance. In fact, we started the company in 2013 with the goal to build the fastest technology on earth. Today we propose a better, faster approach to array code execution: <strong>ILNumerics Accelerator</strong>.</p>
<p>This is part 2 of an article series on ILNumerics Accelerator. In the <a title="ILNumerics Accelerator, Part I" href="/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/">first part</a> we&#8217;ve explained why automatic parallelization was too large a problem for the existing compiler landscape. In the following we start by describing the problem ILNumerics Accelerator solves. Then we&#8217;ll explain how it works.</p>
<h2>The Problem Space</h2>
<p>Math drives the world. High tech companies, financial institutions, medical instruments, rocket science &#8230; The most innovative projects do all have one thing in common: they are driven by numerical data and complex mathematical algorithms working on these data. Most data can be represented as n-dimensional arrays. They allow to implement great complexity without great effort. Consequently, array based algorithms play a huge role in todays most innovative industries.</p>
<p>Over the years we have seen many different attempts to realize the advantage of numerical arrays for small and large developer teams, working on .NET. Some large teams have even built their own solution. And indeed: building a math library in C# is easy to start with! You&#8217;ll see many low hanging fruits. With a few lines of code, you are able to create matrices and to sum them in short expressions, like &#8216;A + B&#8217;! Woooh!! If this is all you need then you can safely skip the rest of this article&#8230;</p>
<p>Often enough managers loose enthusiasm when after some months huge device codes built with such trivial &#8216;solution&#8217; eventually show execution speed far below their requirements.</p>
<p><em>Optimal execution speed is only realized by <strong>efficient </strong>utilization of <strong>all </strong>compute resources.</em></p>
<p>What may sound simple is actually a problem that has been waiting for a solution for more than two decades. Todays hardware is mostly heterogeneous. Even inside a single CPU there are at least two levels of parallelism. Often, there is also at least one GPU around.</p>
<p>The only working way to utilize heterogeneous computing resources today was to manually distribute manually selected parts of an algorithm and its data to manually selected devices. Many tools exist which aim to help the programming expert to decide, write and fine-tune the required codes at development time. This still requires expert knowledge and intimate insights into the data flow of your algorithms. And it requires time. A lot of time! The large codes created this way need testing and maintenance.</p>
<p>Nevertheless, this demanding approach still cannot harness all performance potential! Needless to say that such results are far from being expressive and easy to understand. ILNumerics Accelerator is here to solve this problem for the large domain of numerical array codes.</p>
<h3>The Big Performance Picture</h3>
<p>Let&#8217;s widen our perspective on the performance topic! Three major factors influence execution speed:</p>
<p><strong>1. The Algorithm</strong></p>
<p>Basically, a program performs a transformation of data from one representation (input) into another representation (result). The transformation is described by the program<span style="margin-left: -2pt;margin-right: -2pt">´</span>s algorithm(s). This high-level, business view on software is &#8216;lowered&#8217; by the programmer when she writes the concrete program code, enabling a compiler to understand the intent. In subsequent compilation steps the code is then further lowered by one or more compilers into other representations, which can be better understood by the hardware. So, the programmer and the compiler(s) share responsibility to implement the intended transformation in a way that it is carried out on the available hardware and produces the correct result in the shortest time possible.</p>
<p><strong>2. The Hardware </strong></p>
<p>An optimally fast program must recognize and utilize all available hardware resources. The exact configuration and properties of all devices, however, is typically only known at runtime. This implies that a significant amount of transformation can only be done at runtime (-&gt; JIT compiler). One may say, a program could be specialized for one specific set of computing resources. This is of course true, but it only shifts issues to the next time the hardware is to be renewed. Further, some properties of the hardware are inherently only known at runtime. Two examples: resource utilization rate and influences by other programs / threads running concurrently on the computer. If the final executable program fails to keep all parts of the hardware busy with useful instructions the program will require more time to run than necessary.</p>
<p><strong>3. The Data </strong></p>
<p>In general technical data is made out of individual numbers, or &#8216;scalars&#8217;. Traditionally, processor instructions deal with scalar data only. In array algorithms data forms arrays with arbitrary shape, size and dimensionality. This can be seen as an <em>extension</em> to the traditional scalar data model, since n-dimensional arrays include scalar data as a special case.</p>
<p>The array extension introduces great new complexity. Instead of a single number, having a type and a value, an array instruction deals with input data which may have one or many, often several million individual values! But arrays can also be empty&#8230;</p>
<p>While there is often exactly one way to execute a scalar instruction, to execute an array instruction <em>efficiently</em> requires careful plan and order and to select and align the execution strategy to the (greatly varying) data and hardware properties. Again, failing to do so (at runtime) will lead to sub-optimal execution times.</p>
<p><strong>Workload &amp; Segmentation</strong></p>
<p>Together with the algorithm data forms another important factor: &#8216;workload&#8217;. It is a measure of the number of computational steps required to perform a certain data transform. Let&#8217;s say: the number of clock cycles of a CPU core required to compute the result of the &#8216;sin(A)&#8217; instruction for a matrix A of a certain size. Mapping the workload onto a concrete hardware device yields the effort or cost (in terms of minimal time or energy) required to complete the transform on this device.</p>
<p>Obviously, throughout a program<span style="margin-left: -2pt;margin-right: -2pt">´</span>s execution there are many <em>intermediate steps</em>, transforming various data with varying properties (-sizes, etc.). The overall workload &#8211; in a slightly simplified view &#8211; is the aggregation of all workloads of all intermediate steps.</p>
<p>To keep a program<span style="margin-left: -2pt;margin-right: -2pt">´</span>s execution time small, all intermediate steps must be carefully adopted to and execute on the fastest hardware resource(s) currently available, yielding the lowest cost. Compare this to how a programmer today manually selects a certain device for (manually selected) large, predefined parts of a program at development time!</p>
<p><strong>Manual segmentation and device resource selection cannot bring optimal performance for all parts of a program.</strong></p>
<h2>Array Codes &#8211; done (&amp; run) right</h2>
<p>The considerations above should make it obvious that no static compiler is able to create optimal execution performance (letting toy examples aside). Data and hardware properties are subject to change! So does the optimal strategy for lowering the individual parts of a user algorithm to hardware instructions! Lowest execution times will only be achieved, if <em>all parallel potential</em> of an algorithm is identified and used to execute its instructions <em>concurrently,</em> on <em>all </em>available hardware resources, and <em>efficiently</em>.</p>
<p>But let&#8217;s skip all reasoning and jump right into the interesting part! Here is how ILNumerics Accelerator achieves exactly this goal:</p>
<ol>
<li>Array instructions within the user program are identified and merged into &#8216;<em>segments</em>&#8216;.</li>
<li>Segments limits are optimized to hold chunks of suitable workload whose size can be quickly determined at runtime.</li>
<li>Before executing a segment &#8230;
<ol start="1">
<li>The cost of the segment with the current data is computed for each hardware resource.</li>
<li>The best (i.e.: the fastest) hardware resource is selected.</li>
<li>The segments array instructions are optimized for the selected resource and current data.</li>
</ol>
</li>
<li>The kernel is scheduled on the selected resource for <em>asynchronous</em> execution and cached for later reuse.</li>
</ol>
<p>Likely, this list requires some explanation.</p>
<div style="width: 474px; " class="wp-video"><video class="wp-video-shortcode" id="video-1064-2" width="474" height="267" preload="metadata" controls="controls"><source type="video/mp4" src="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4?_=2" /><a href="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4">https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4</a></video></div>
<p>[ Video does not show? Download here: <a href="/media/andere/ILNumerics_Segments_2022.mp4">https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4</a> ]</p>
<p>ILNumerics Accelerator takes a new approach to efficient array code execution. Instead of attempting global analysis (the top-down approach which failed in so many projects) we optimize the program from the bottom-up. Our compiler recognizes all fundamental array instructions and expressions thereof, merges them into &#8216;islands&#8217; (segments) of well-known semantics and execution cost. Each segment contains a small JIT compiler, specialized to quickly compile the segments instructions at runtime into highly optimized low-level codes – for the .NET CLR <em>and</em> for any OpenCL device! This step recognizes and adopts to all hardware and data properties found at runtime. And it maintains compatibility with all .NET platforms.</p>
<p>Currently, we support unary, binary and reduction array instructions provided by ILNumerics Computing Engine and all expressions made thereof. No changes or annotations are required to existing codes. The ILNumerics language supports all features of the Matlab and numpy languages. It will be possible to build connectors to other languages and to custom array libraries exposing similar semantics.</p>
<p>During build each array expression is automatically replaced from the user code files with a call to a specialized, auto-generated segment. Next to hosting a JIT for the array instructions a segment also &#8216;knows&#8217; the workload of its inherent computations. When at runtime the segment is called, it uses this info to compute the cost for executing the segment on each device and to identify the device suggesting earliest completion. Afterwards, it enqueues the optimized kernel to this device for computation.</p>
<p>It then &#8211; without waiting for a result &#8211; immediately passes on control to the next segment in the algorithm. Now, if subsequent segments do not depend on each other they are scheduled onto different threads or devices and execute in parallel!</p>
<p>All technical details of the new method are found in the patents and patent applications listed at the end of this article.</p>
<h3>Advantages</h3>
<p>ILNumerics Accelerator automatically executes your algorithm in the fastest possible way:</p>
<ul>
<li>During execution it finds chunks of workload which can be computed concurrently.</li>
<li>It identifies the best suited hardware device available at this time.</li>
<li>For each segment it adopts the execution strategy to the fastest device, and</li>
<li>Computes the workload of many segments in parallel.</li>
</ul>
<p>Therefore, it s<em>cales </em>execution times with the hardware <em>without recompilation or manual code adjustments.</em></p>
<p>Our compiler &#8230;</p>
<ul>
<li>Supports vector registers, multiple CPU cores, and all OpenCL devices.</li>
<li>Removes temporary arrays and manages memory between devices transparently.</li>
<li>Applies many new and important optimizations, on kernel and on segment level.</li>
<li>Fully managed solution: it targets the .NET CLR, thus is compatible with all .NET platforms.</li>
</ul>
<p>&#8230; which brings many benefits:</p>
<ul>
<li>Efficient use of all compute resources.</li>
<li>No expert effort required.</li>
<li>Shorter time to market.</li>
<li>Adjusts to new hardware.</li>
<li>Maintains maintainability.</li>
</ul>
<h3>&#8220;How much faster is it&#8221;?</h3>
<p>This is a very popular question! A comprehensive answer deserves its own article, really.</p>
<p>In short: it depends on your hardware. It depends on your algorithm. And it depends on your data! The question should rather be: how much more efficiently will it utilize my hardware? For the majority of real-world algorithms is true: as efficient as possible! Moreover, it does so <em>automatically</em>!</p>
<p>(If you are still longing for a number: on 2015-ish hardware we see speed increase rates between 3 and more than 300. Most of the time optimized code runs faster by at least a magnitude.)</p>
<h3>Where can I get it ?</h3>
<p>ILNumerics Accelerator has entered the public beta phase. It will be released with ILNumerics Ultimate VS version 7. The pre-release is available on nuget. <a title="Getting Started Guide I - Sum Examples" href="/accelerate-sum-examples.html">Start here !</a> General documentation on the new Accelerator is found <a title="ILNumerics Accelerator Compiler Documentation" href="/ilnumerics-accelerator-compiler.html">here</a>. It will subsequently be completed within the next weeks.</p>
<h3>Patents</h3>
<p>ILNumerics software is protected by international patents and patent applications. WO2018197695A1, US11144348B2, JP2020518881A, EP3443458A1, DE102017109239A1, CN110383247A, DE102011119404.9, EP22156804. ILNumerics is a registered trademark of ILNumerics GmbH, Berlin, Germany.</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/">ILNumerics Accelerator – A better Approach to faster Array Codes, Part II</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="https://ilnumerics.net/media/andere/ILNumerics_Segments_2022.mp4" length="1709355" type="video/mp4" />
		</item>
		<item>
		<title>ILNumerics Accelerator – A better Approach to faster Array Codes, Part I</title>
		<link>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/#comments</comments>
		<pubDate>Mon, 31 Oct 2022 21:10:26 +0000</pubDate>
		<dc:creator><![CDATA[haymo]]></dc:creator>
				<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Numerical Algorithms]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[accelerator]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[hpc]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=1069</guid>
		<description><![CDATA[<p>A Truth most Programmers won&#8217;t tell. TLDR: It was twenty years ago when computer manufacturers, while trying to boost CPU performance, were confronted with the hard wall imposed by physical limitations. It took a long time for everyone involved to realize that individual processors could no longer become significantly faster in the future. The previous &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics Accelerator – A better Approach to faster Array Codes, Part I</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/">ILNumerics Accelerator – A better Approach to faster Array Codes, Part I</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>A Truth most Programmers won&#8217;t tell.</h2>
<p style="font-size: +1.1em; margin-bottom: 1em; text-align: justify;"><em>TLDR: It was twenty years ago when computer manufacturers, while trying to boost CPU performance, were confronted with the hard wall imposed by physical limitations. </em><em>It took a long time for everyone involved to realize that individual processors could no longer become significantly faster in the future. The previous approach made it too simple to deal with the constantly growing demands caused by ever larger data and ever more complex programs. </em><em>Haymo Kutschbach, founder and CEO of ILNumerics explains the challenges involved for automatic parallelization on today&#8217;s hardware and why traditional compilers will not satisfy the strong demand for a feasible solution. </em><em>A better, working approach is presented.</em></p>
<p align="right">Reading time: 10 minutes</p>
<p>For many decades, the rule applied: &#8220;Your program is too slow? Simply buy the latest hardware!&#8221; This was made possible by the availability of (general purpose) programming languages, as well as a stream of innovations in processor architectures and the associated compilers. They allowed the programs to be written largely independently of the execution hardware. The compiler adapted abstract codes to the low-level features of the processors. Everything fit together so conveniently!</p>
<p>And then nature threw a spanner in the works on this easy calculation. We&#8217;ve seen new computers continueing to obey Moore&#8217;s Law and become more powerful with each generation. But this new computing power is now distributed over many processors! A program can only use the new speed if it can use all processors at the same time. In addition, a significant part of the computing power of today&#8217;s computers is found in heterogeneous architectures such as GPUs and other accelerator hardware.</p>
<p>The consequences can be observed today in probably every development department: Programs are written abstractly. Efforts are made to create &#8216;clean code&#8217; that can be tested and maintained. Unfortunately, it is often executed too slowly, though! So you start to examine the codes for optimization potential. You identify individual bottlenecks, decide manually on a parallelization strategy, implement, test and measure again. Many programmers don&#8217;t see this as a problem – their expert knowledge guarantees them a good income for many years to come! Since there are no alternatives, the enormous delays in time to market are accepted. Just like the fact that the next generation of devices will again require a complete rewrite for large parts of the software.</p>
<p>Hardware today is far more diverse and heterogeneous than it was 20 years ago. But why is that actually a problem? Why are we still not able to <em>automatically </em>adapt and run our programs on such hardware again?</p>
<h2>If it&#8217;s too slow, blame the Compiler!</h2>
<p>For one, it&#8217;s because the compiler market has traditionally been dominated by processor manufacturers. Their compilers served to make their own hardware more accessible. Even though we&#8217;ve seen a recent trend towards vendor-independent compilers, they still continue the traditional approach: compiling (“lowering&#8221;) code of a general purpose programming language (like C or Fortran) to hardware instructions that can be executed on a specific (and previously selected) processor architecture. What we actually need, however, is a compiler that translates an abstract program for a &#8220;computer&#8221; &#8211; with all its diverse computing resources.</p>
<p>This task, however, is much more demanding! Why? Here we come to the second reason that has so far prevented a working solution: granularity. In order to be able to use parallel resources, the software must contain additional instructions that take care of the distribution of the individual program parts. This additional overhead makes a certain minimum program size (workload) mandatory. Parallelization only makes sense if the gain in speed through parallel execution exceeds the additional management effort!</p>
<p>Here, the term &#8220;granularity&#8221; refers to the number of individual low -level instructions that a piece of code requires to calculate its result. Apparently, the granularity increases with the size or complexity of a program part, because more low-level instructions are executed at the end. So, in order to make efficient use of parallelism, it is not enough to consider individual instructions of a program. Rather, a compiler must merge larger program parts (‘grains’) and distribute them to the available computing resources . One of the most important challenges of a parallelizing compiler is to find the optimal size of these &#8220;chunks&#8221; &#8211; and thus the optimal granularity.</p>
<p>This brings us to the third reason: complexity. In general, programs can become arbitrarily complex. Compilers have the task of translating programs into another, useful form. But how does one translate information that can be arbitrarily complex? Traditional compilers achieve this goal by limiting their consideration to individual instructions in the program. They know the (manageable) set of possible translations for each of these instructions. The finished program is then little more than the chain of such individual translations. Nevertheless, traditional compilers are already considered to be extremely complex software!</p>
<p>Unfortunately, this &#8220;complexity reduction&#8221; trick is in direct contradiction to the necessary, minimal granularity described above. A parallelizing compiler must face the challenge of finding an optimal translation even for program chunks that consist of multiple or many instructions. As always, low hanging fruits exist (see e.g.: tensorflow). However, an optimal solution must not restrict itself to individual, specific instructions just because their translation is particularly simple and therefore easy to implement!</p>
<p>And then there is a fourth aspect that also plays into the area of complexity. In addition to the optimal chunk size (granularity), it is also important to identify those grains of a program that can be executed independently of one another. The program analysis required must also take into account the best possible granularity. A compiler must therefore be able to <em>understand </em>large program sections, form chunks of an optimal grain size and execute them efficiently in parallel on heterogeneous hardware.</p>
<p>Ultimately, it is the complexity of this task that has so far prevented such a compiler from being born. In general, development departments still follow the manual approach described earlier. It requires expert knowledge and enormous effort to <em>manually </em>perform the necessary steps (granularity and independence analysis, parallel implementation) for <em>a special program </em>. But despite the enormous amount of time, despite the enormous maintenance issues associated, this approach allows to scratch the surface only! It can neither address nor solve the real problem.</p>
<h2><strong>Are we lost?</strong></h2>
<p>Not yet! Let’s wrap it up:</p>
<ul>
<li>Traditional compilers work at too low a level of granularity. They consider too few instructions to cover a workload, suitable for efficient parallelization.</li>
<li>Previous attempts to include large/all program parts in an analysis have only been successful in a few special cases. Global analysis for general programs is an unsolved problem and, in the opinion of the author, will remain so for a long time to come.</li>
</ul>
<p>But now we come to the topic of our headline! For a not too small class of programs ILNumerics succeeded in developing a compiler that fulfills all optimality requirements. It is the class of numeric, array-based programs. They are written by scientists, mathematicians, and engineers to encode the innovations of our modern times. They form the core of big data, machine learning and artificial intelligence, and all codes, making use of them. Numerical algorithms realize innovations – moreover: they <em>are </em>these innovations! They allow to formulate great complexity without great effort. They handle huge data and, therefore, require greatest speed.</p>
<p>A development department, faced with the challenge of accelerating its numerical array codes can only select and use the best possible language and libraries there are. Technical requirements often rule out prototyping languages, like numpy and Matlab. Individual parts may be outsourced to GPUs. Other parts are parallelized using multithreading. All of this slows down the industrial development process significantly. It is like writing GUI programs in assembler…</p>
<h2>A Better Approach to faster Array Codes</h2>
<p>ILNumerics proposes a new, faster approach to the execution of array codes. ILNumerics Accelerator, automatically finds parallel potential in array-based algorithms (as: numpy, Matlab, ILNumerics) and efficiently distributes its workload to heterogeneous computing resources &#8211; dynamically and at runtime, when all important information is available. It again scales your algorithm speed to any heterogeneous hardware without recompilation.</p>
<p>The <a title="ILNumerics Accelerator Compiler Documentation" href="/ilnumerics-accelerator-compiler.html">online documentation</a> describes technical details of the ILNumerics Accelerator Compiler. Make sure to <a href="https://eepurl.com/9loxX">register for our newsletter here</a> and don&#8217;t miss any news!</p>
<h3>Where can I get it ?</h3>
<p>ILNumerics Accelerator has entered the public beta phase. It will be released with ILNumerics Ultimate VS version 7. The pre-release is available on nuget. <a title="Getting Started Guide I - Sum Examples" href="/accelerate-sum-examples.html">Start here !</a> General documentation on the new Accelerator is found <a title="ILNumerics Accelerator Compiler Documentation" href="/ilnumerics-accelerator-compiler.html">here</a>. It will subsequently be completed within the next weeks. Read the getting <a title="Getting Started (I) with ILNumerics Accelerator" href="/accelerate-sum-examples.html">started guide(s)</a>, get your hands dirty and please, <a href="mailto:info@ilnumerics.net?subject=ILNumerics%20Accelerator%20Feedback">let us know what you think</a>!</p>
<h3>Patents</h3>
<p>ILNumerics software is protected by international <a href="https://ilnumerics.net/imprint.html">patents and patent applications</a>.</p>
<p>DE102011119404.9, WO2018197695A1, US11144348B2, CN110383247A, JP2020518881A, EP3443458A1, EP22156804, US20230259338A1, JP7495028B2, CN116610436A, EP23173406.2, PCT/EP2024/062463</p>
<p>. ILNumerics is a registered trademark of ILNumerics GmbH, Berlin, Germany.</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/">ILNumerics Accelerator – A better Approach to faster Array Codes, Part I</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-accelerator-a-better-approach-to-faster-array-codes-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why MINT-students should learn C# instead of Matlab and R</title>
		<link>https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/</link>
		<comments>https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/#comments</comments>
		<pubDate>Sat, 30 May 2020 10:20:48 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Matlab]]></category>
		<category><![CDATA[Numerical Algorithms]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[Scientific Computing]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=1017</guid>
		<description><![CDATA[<p>For students who want to prototype and code, there’s a wide range of domain specific programming languages around: R or Matlab – just to name a few – make it quite easy to design new algorithms, analyze data and to plot complex functions. However, bringing innovation from science to enterprise-ready software applications still costs lots &#8230; <a href="https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/" class="more-link">Continue reading <span class="screen-reader-text">Why MINT-students should learn C# instead of Matlab and R</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/">Why MINT-students should learn C# instead of Matlab and R</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>For students who want to prototype and code, there’s a wide range of domain specific programming languages around: R or Matlab – just to name a few – make it quite easy to design new algorithms, analyze data and to plot complex functions. However, bringing innovation from science to enterprise-ready software applications still costs lots of effort, manpower and experience.</p>
<p>Microsoft’s C# has the potential to fully close this gap: in combination with the ILNumerics numerical library, it becomes the perfect environment both for prototyping and creating powerful software. But why is it that the mainstream in science still doesn’t make use of the power of C#, .NET and Visual studio? Well, let’s have a closer look at computing in academia.</p>
<h2>Scientific Computing vs. Real-Life Applications</h2>
<p>Like in many other areas in academia, the main reason for sticking to out-of-date techniques is “tradition”. That’s why in 2020 there is still a huge gap between mathematical prototyping and industrial-grade production software. Scientists often aim at creating an algorithm solely in order to validate a new model or theory. Once done, they produce a couple of nice looking plots, publish a paper or two and: bye bye.</p>
<p>Unless&#8230; there is a greater use to it!</p>
<h2>Turning Prototypes into Products</h2>
<p>If a model created in science has the potential to earn serious money,  the algorithm created by a mathematician, physicist or microbiologist has to be transformed into something &#8216;production ready&#8217; that can be used in real life.</p>
<p>This is where many development teams in the biggest enterprises are stuck today: Everytime they want to adapt innovation from science for their own software applications, they have to translate Matlab, numpy or R codes into a modern, managed SW framework. This transformation is where the pain starts: It has to be done! And not only once, but with each update. This causes a whole lot of redundant and boilerplate code &#8211; each and every time. This work is expensive: It requires expert knowledge, extensive testing and additional maintenance. And it significantly delays the time to market!</p>
<h2>C# + ILNumerics: Perfect Match for High Performance Applications</h2>
<p>This pain needs to stop. And this is where modern general purpose languages come into play. C# for example fulfills all the requirements for the design of numerical algorithms! Developer tools such as Visual Studio &#8211; especially if complemented with the ILNumerics Array Visualizer und its highly efficient n-dimensional arrays &#8211; allow scientists and software developers to design and prototype their algorithms by directly using production-ready tools.</p>
<p>That means: the painful and time consuming transformation from domain specific prototyping code to an industrial software product is no longer necessary, which allows for huge time savings – often more than 50 percent!</p>
<h2>Maths, Physics, Engineering: Boost Innovation now!</h2>
<p>However, most established scientists in academia today still stick to Matlab, numpy and R &#8211; even though it’s not necessary anymore. But fortunately, a new generation of scientists has started to push innovation at universities ahead. They are often familiar with modern programming languages like C#, and they want to use their knowledge to combine academic prototyping with state of the art software development. This new generation will modernize the intersections between science and industry. Their skills will allow companies all over the world to realize all their innovative potential in a much shorter period of time.</p>
<p>That’s why we think any science and engineering student should get familiar with modern programming languages as early as possible: It will help him or her to boost innovation in their field all over the world!</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/">Why MINT-students should learn C# instead of Matlab and R</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/why-mint-students-should-learn-c-instead-of-matlab-and-r/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>N-dim Array Broadcasting Efficiency in ILNumerics 4.10</title>
		<link>https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/</link>
		<comments>https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/#comments</comments>
		<pubDate>Sun, 01 May 2016 09:47:13 +0000</pubDate>
		<dc:creator><![CDATA[haymo]]></dc:creator>
				<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Usage]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Broadcasting]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[vectorization]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=915</guid>
		<description><![CDATA[<p>Next to other great improvements in version 4.10 of ILNumerics Ultimate VS, it is especially one new feature which requires some attention: general broadcasting for n-dimensional ILArrays. Broadcasting as a concept today is found in many popular mathematical prototyping systems. The most direct correspondence probably exists in the numpy package. Matlab and Octave offer similar &#8230; <a href="https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/" class="more-link">Continue reading <span class="screen-reader-text">N-dim Array Broadcasting Efficiency in ILNumerics 4.10</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/">N-dim Array Broadcasting Efficiency in ILNumerics 4.10</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Next to other great improvements in version 4.10 of ILNumerics Ultimate VS, it is especially one new feature which requires some attention: general broadcasting for n-dimensional ILArrays.</p>
<p>Broadcasting as a concept today is found in many popular mathematical prototyping systems. The most direct correspondence probably exists in the <a href="http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html">numpy </a>package. Matlab and Octave offer similar functionality by means of the <a href="http://de.mathworks.com/help/matlab/ref/bsxfun.html">bsxfun function</a>.</p>
<p>The term &#8216;broadcasting&#8217; refers to a binary operator which is able to apply an elementwise operation to the elements of two n-dimensional arrays. The &#8216;operation&#8217; is often as simple as a straight addition (ILMath.add, ILMath.divide, a.s.o.). However, what is special about broadcasting is that it allows the operation even for the case where both arrays involved do not have the same number of elements.</p>
<h2>Broadcasting in ILNumerics prior Version 4.10</h2>
<p>In ILNumerics, broadcasting is available for long already. But prior version 4.10 it was limited to scalars operating on n-dim arrays and vectors operating on matrices. Therefore, we had used the term &#8216;vector expansion&#8217; instead of broadcasting. Obviously, broadcasting can be seen as a generalization of vector expansion.</p>
<p>Let&#8217;s visualize the concept by considering the following matrix A:</p>
<pre class="brush: csharp; title: ; notranslate">
A

1  5   9  13  17
2  6  10  14  18
3  7  11  15  19
4  8  12  16  20
</pre>
<p>Matrix A might represent 5 data points of a 4 dimensional dataset as columns. One common requirement is to apply a certain operation to all datapoints in a similar way. In order to, let&#8217;s say, scale/weight the components of each dimension by a certain factor, one would multiply each datapoint with a vector of length 4.</p>
<pre class="brush: csharp; title: ; notranslate">

ILArray&lt;double&gt; V = new[] { 0.5, 3.0, 0.5, 1.0 };

0.5
3.0
0.5
1.0
</pre>
<p>The traditional way of implementing this operation would be to expand the scaling vector by replicating it from a single column to a matrix matching the size of A.</p>
<pre class="brush: csharp; title: ; notranslate">
VExp = repmat(V, 1, 5); 

0.5  0.5  0.5  0.5  0.5
3.0  3.0  3.0  3.0  3.0
0.5  0.5  0.5  0.5  0.5
1.0  1.0  1.0  1.0  1.0
</pre>
<p>Afterwards, the result can be operated with A elementwise in the common way.</p>
<pre class="brush: csharp; title: ; notranslate">
ILArray&lt;double&gt; Result = VExp * A;

0.5   2.5   4.5   6.5   8.5
6.0  18.0  30.0  42.0  54.0
1.5   3.5   5.5   7.5   9.5
4.0   8.0  12.0  16.0  20.0
</pre>
<p>The problem with the above approach is that the vector data need to be expanded first. There is little advantage in doing so: a lot of new memory is being used up in order to store completely redundant data. We all know that memory is the biggest bottleneck today. We should prevent from lots of memory allocations whenever possible. This is where vector expansion comes into play. In ILNumerics, for long, one can prevent from the additional replication step and operate the vector on the matrix directly. Internally, the operation is implemented in a very efficient way, without replicating any data, without allocating new memory.</p>
<pre class="brush: csharp; title: ; notranslate">
ILArray&lt;double&gt; Result = V * A;

0.5   2.5   4.5   6.5   8.5
6.0  18.0  30.0  42.0  54.0
1.5   3.5   5.5   7.5   9.5
4.0   8.0  12.0  16.0  20.0</pre>
<h2>Generalizing for n-Dimensions</h2>
<p>Representing data as matrices is very popular in scientific computing. However, if the data are stored into arrays of other shapes, having more than two dimensions, one had to fall back to repmatting in order for the binary operation to succeed. This nuissance has been removed in version 4.10.</p>
<p>Now it is possible to apply broadcasting to two arrays of <em>any matching</em> shape &#8211; without the need for using repmat. In order for two arrays to &#8216;<em>match</em>&#8216; in the binary operation, the following rules must be fullfilled:</p>
<ol>
<li>All corresponding dimensions of both arrays must match.</li>
<li>In order for two  corresponding dimensions to match,
<ul>
<li>both dimensions must be of the same length, or</li>
<li>one of the dimensions must be of length 1.</li>
</ul>
</li>
</ol>
<p>An example of two matching arrays would be a vector running along the 3rd dimension and a 3 dimensional array:</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2016/12/3D-Cubes-4-Broadcasting2.png"><img class="aligncenter size-full wp-image-929" src="http://ilnumerics.net/blog/wp-content/uploads/2016/12/3D-Cubes-4-Broadcasting2.png" alt="3D Cubes 4 Broadcasting2" width="655" height="485" /></a>In the above image the vector (green) has the same length as the corresponding dimension of the 3D array (gray). The size of the vector is [1 x 1 x 6]. The size of the 3D array is [4 x 5 x 6]. Hence, any dimension of both, the vector and the 3D array &#8216;match&#8217; in terms of broadcasting. A broadcasting operation for both, the vector and the array would give the same result as if the vector would be replicated along the 1st and the 2nd dimensions. The first element will serve all elements in the first 4 x 5 slice in the 1-2 plane. This slice is marked red in the next image: <a href="http://ilnumerics.net/blog/wp-content/uploads/2016/12/3D-Cubes-4-Broadcasting_slice1.png"><img class="aligncenter size-full wp-image-931" src="http://ilnumerics.net/blog/wp-content/uploads/2016/12/3D-Cubes-4-Broadcasting_slice1.png" alt="3D Cubes 4 Broadcasting_slice" width="812" height="633" /></a>Note that all red elements here derive from the same value &#8211; from the first element of the green vector.  The same is true for all other vector elements: they fill corresponding slices on the 3D array along the 3rd dimension.</p>
<p>Slowly, a huge performance advantage of broadcasting becomes clear: the amount of memory saved explodes when more, longer dimensions are involved.</p>
<h2> Special Case: Broadcasting on Vectors</h2>
<p>In the most general case and if broadcasting is blindly applied, the following special case potentially causes issues. Consider two vectors, one row vector and one column vector being provided as input parameters to a binary operation. In ILNumerics, every array carries at least two dimensions. A column vector of length 4 is considered an array of size [4 x 1]. A row vector of length 5 is considered an array of size [1 x 5]. In fact, <em>any</em> two vectors match according to the general  broadcasting rules.</p>
<p>As a consequence operating a row vector [1 x 5] with a column vector [4 x 1] results in a matrix [4 x 5]. The row vector is getting &#8216;replicated&#8217; (again, without really executing the replication) four times along the 1st dimension, and the column vector 5 times along the rows.</p>
<pre class="brush: csharp; title: ; notranslate">
array(new[] {1.0,2.0,3.0,4.0,5.0}, 1, 5) +array(new[] {1.0,2.0,3.0,4.0}, 4, 1)

&lt;Double&gt; [4,5]
[0]:          2          3          4          5          6
[1]:          3          4          5          6          7
[2]:          4          5          6          7          8
[3]:          5          6          7          8          9
</pre>
<p>Note, in order for the above code example to work, one needs to apply a certain switch:</p>
<pre class="brush: csharp; title: ; notranslate">
Settings.BroadcastCompatibilityMode = false;
</pre>
<p>The reason is that in the traditional version of ILNumerics (just like in Matlab and Octave) the above code would simply not execute but throw an exception instead. Originally, binary operations on vectors would ignore the fact that vectors are matrices and only take the length of the vectors into account, operating on the corresponding elements if the length of both vectors do match. Now, in order to keep compatibility for existing applications, we kept the former behavior.</p>
<p>The new switch &#8216;Settings.BroadcastCompatibilityMode&#8217; by default is set to &#8216;true&#8217;. This will cause the Computing Engine to throw an exception when two vectors of inequal length are provided to binary operators. Applying vectors of the same length (regardless of their orientation) will result in a vector of the same length.</p>
<p>If the &#8216;Settings.BroadcastCompatibilityMode&#8217; switch is set to &#8216;false&#8217; then general broadcasting is applied in all cases according to the above rules &#8211; even on vectors. For the earlier vector example this leads to the resulting matrix as shown above: operating a row on a column vector expands both vectors and gives a matrix of corresponding size.</p>
<p>Further reading: <a href="http://ilnumerics.net/Opoverload.html">binary operators, online documentation</a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/">N-dim Array Broadcasting Efficiency in ILNumerics 4.10</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/n-dim-array-broadcasting-efficiency-in-ilnumerics-4-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ILNumerics for Science &#8211; Computation and Visualization</title>
		<link>https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/#comments</comments>
		<pubDate>Mon, 30 Mar 2015 13:42:01 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=882</guid>
		<description><![CDATA[<p>How did you do that? – The Computation Wrapping up our series of ILNumerics and science we take a closer look at computation and science. Easily code your science into a robust, reliable program with high-speed performance. Science of Function Rules Now that we’re 3 posts in this series I have to address something our &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics for Science &#8211; Computation and Visualization</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/">ILNumerics for Science &#8211; Computation and Visualization</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h2>How did you do that? – The Computation</h2>
<p style="text-align: justify;">Wrapping up our series of ILNumerics and science we take a closer look at computation and science. Easily code your science into a robust, reliable program with high-speed performance.</p>
<p style="text-align: justify;"><span id="more-882"></span></p>
<h3>Science of Function Rules</h3>
<p style="text-align: justify;">Now that we’re 3 posts in this series I have to address something our support team and our development team told me to: Function Rules. These are important for computation in science because they speed things up.</p>
<p style="text-align: justify;">We encourage everybody to follow these rules because it makes your code faster and more readable. If you follow the function rules you give the computation engine more information about the intended use of the arrays you declare. There are four types:</p>
<ol>
<li style="text-align: justify;">Local arrays: They are declared and used only in the function scope. After leaving the function the memory is released and can be reused.</li>
<li style="text-align: justify;">Input arrays: These are the input parameters to a function. They are immutable and should be used only once when copied to a local array.</li>
<li style="text-align: justify;">Output arrays: With this option many different arrays can be returned to the calling function. In the calling function an array must be declared and passed to the called function.</li>
<li style="text-align: justify;">Return arrays: These arrays are the return values of functions. They are erased immediately after usage.</li>
</ol>
<p style="text-align: justify;">What I found most interesting are the output arrays. In the header of the function I can declare a number of output arrays. However, they are optional. When I call this function I don’t need to pass any of these to the function. If an output array is omitted that means that I’m not interested in this particular array. The function will then only calculate the arrays that I’m interested in and omit the rest of the code. This is a powerful tool to save development time and run time &#8211; and gets you back to science quicker.</p>
<h3>Computation Module</h3>
<p style="text-align: justify;">Now, let’s get back to our 2D particle in a box. We still need to add the computation module. This is easily done by right-clicking on your WindowsFormsApplication in the solution explorer and adding the computation module. This will create a class called Computing_Module1 that is derived from ILMath. It comes with a few example functions where you can see some examples of the function rules.</p>
<p>Here is again the code that will calculate the wave function on a grid:</p>
<pre class="brush: csharp; title: ; notranslate">
public static ILRetArray&lt;double&gt; CalcWF(int EVXID, int EVYID, double LX, double LY, int MeshSize)
{
   ILArray&lt;double&gt; X = linspace&lt;double&gt;(0, LX, MeshSize);
   ILArray&lt;double&gt; Y = linspace&lt;double&gt;(0, LY, MeshSize);
   ILArray&lt;double&gt; Y2d = 1;
   ILArray&lt;double&gt; X2d = meshgrid(X, Y, Y2d);
   ILArray&lt;double&gt; Z = sqrt(4.0 / LX / LY) * sin(EVXID * pi * X2d / LX) * sin(EVYID * pi * Y2d / LY);
   return Z.Concat(X2d,2).Concat(Y2d,2);
}
</pre>
<p style="text-align: justify;">I put everything in one function here but will now separate the code into more than one function to show how the function rules should be applied. I’ll keep the CalcWF function and will add two more functions. One function will calculate the meshgrid and the other function will actually calculate the wave function values on the grid.</p>
<pre class="brush: csharp; title: ; notranslate">
public static void getGrid(ILInArray&lt;double&gt; inX, ILInArray&lt;double&gt; inY, ILOutArray&lt;double&gt; outX2d = null, ILOutArray&lt;double&gt; outY2d = null)
{
   using (ILScope.Enter(inX, inY))
   {
      ILArray&lt;double&gt; X = check(inX);
      ILArray&lt;double&gt; Y = check(inY);
      outY2d.a = 1;
      outX2d.a = meshgrid(X, Y, outY2d);
      return;
   }
}
</pre>
<p style="text-align: justify;">This piece of code generates the grid over which the wave function will be calculated. I obeyed all function rules here. Obviously, this is not really necessary for such a small problem but I wanted to show the best practice here. This function basically gives back two arrays, outX2d and outY2d. This is only possible with ILOutArray as functions can only return one object.</p>
<pre class="brush: csharp; title: ; notranslate">
public static ILRetArray&lt;double&gt; getWF(int EVXID, int EVYID, double LX, double LY, ILInArray&lt;double&gt; inX2d, ILInArray&lt;double&gt; inY2d)
{
   using (ILScope.Enter(inX2d, inY2d))
   {
      ILArray&lt;double&gt; X2d = check(inX2d);
      ILArray&lt;double&gt; Y2d = check(inY2d);
      return sqrt(4.0 / LX / LY) * sin(EVXID * pi * X2d / LX) * sin(EVYID * pi * Y2d / LY);
   }
}
</pre>
<p style="text-align: justify;">This function will calculate the values of the wave function on a given grid. Declaring the return value as ILRetArray will make sure that the array that is calculated in the last line will be thrown away after the function is executed.</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/">ILNumerics for Science &#8211; Computation and Visualization</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-for-science-computation-and-visualization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ILNumerics for Scientists &#8211; Going 3D</title>
		<link>https://ilnumerics.net/blog/ilnumerics-for-scientists/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-for-scientists/#comments</comments>
		<pubDate>Tue, 20 Jan 2015 15:38:39 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Interesting/ useless]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[3d visualization]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[Quantum Mechanics]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=761</guid>
		<description><![CDATA[<p>Recap Last time I started with one of the easiest problems in quantum mechanics: the particle in a box. This time I’ll add 1 dimension and we’ll see a particle in a 2D box. To visualize its wave function and density we need 3D surface plots. 2D Box This time we have a particle that &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-for-scientists/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics for Scientists &#8211; Going 3D</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists/">ILNumerics for Scientists &#8211; Going 3D</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3>Recap</h3>
<p style="text-align: justify;"><a title="ILNumerics for Scientists – An easy start" href="http://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">Last time </a>I started with one of the easiest problems in quantum mechanics: the particle in a box. This time I’ll add 1 dimension and we’ll see a particle in a 2D box. To visualize its wave function and density we need 3D surface plots.</p>
<h3>2D Box</h3>
<p style="text-align: justify;">This time we have a particle that is confined in a 2D box. The potential within the box is zero and outside the box infinity. Again the solution is well-known and can be found on <a href="https://en.wikipedia.org/wiki/Particle_in_a_box">Wikipedia</a>. This time the state of the wave function is determined by two numbers. These are typically called quantum numbers and refer to the X and the Y direction, respectively.</p>
<p style="text-align: justify;">The absolute size of the box doesn’t really matter and we didn’t worry about it in the 1D case. However, the relative size of the length and the width make a difference. The solution to our problem reads</p>
<p style="text-align: center;">$\Psi_{n,k}(x,y) = \sqrt{\frac{4}{L_x L_y}} \cdot \sin(n \cdot \pi \cdot x / L_x) \cdot \sin(k \cdot \pi \cdot y / L_y)$</p>
<h3>The Math</h3>
<p style="text-align: justify;">Very similar to the 1D case I quickly coded the wave function and the density for further plotting. I had to make sure that the arrays are fit for 3D plotting, so the code looks a little bit different compared to last post’s</p>
<pre class="brush: csharp; title: ; notranslate">
     public static ILArray&lt;double&gt; CalcWF(int EVXID, int EVYID, double LX, double LY, int MeshSize)
     {
        ILArray&lt;double&gt; X = linspace&lt;double&gt;(0, LX, MeshSize);
        ILArray&lt;double&gt; Y = linspace&lt;double&gt;(0, LY, MeshSize);

        ILArray&lt;double&gt; Y2d = 1;
        ILArray&lt;double&gt; X2d = meshgrid(X, Y, Y2d);

        ILArray&lt;double&gt; Z = sqrt(4.0 / LX / LY) * sin(EVXID * pi * X2d / LX) * sin(EVYID * pi * Y2d / LY);

        return Z.Concat(X2d,2).Concat(Y2d,2);
     }
</pre>
<p>Again, this took me like 10 minutes and I was done.</p>
<h3>The Visualization</h3>
<p>This time the user can choose the quantum numbers for X and Y direction, the ratio between the length and the width of the box and also the number of mesh points along each axis for plotting. This makes the visualization panel a little bit more involved. Nevertheless, it’s still rather simple and easy to use. This time it took me only 45 minutes – I guess I learned a lot from last time.</p>
<h3>The result</h3>
<p>Here is the result of my little program. You can click and play with it. If you’re interested, you can download the <a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.zip">Particle2DBox</a> source code. Have fun!</p>
<p style="text-align: justify;"><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.jpg"><img class="aligncenter wp-image-767 size-full" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.jpg" alt="Particle2DBox" width="928" height="640" /></a>This is a screenshot of the application. I chose the second quantum number along the x axis and the fourth quantum number along the y axis. The box is twice as long in y direction as it is in x direction. The mesh size is 100 in each direction. On the left hand side you see the wave function and on the right hand side the probability density.</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists/">ILNumerics for Scientists &#8211; Going 3D</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-for-scientists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Directions to the ILNumerics Optimization Toolbox</title>
		<link>https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/</link>
		<comments>https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/#comments</comments>
		<pubDate>Wed, 14 Jan 2015 16:27:44 +0000</pubDate>
		<dc:creator><![CDATA[haymo]]></dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Usage]]></category>
		<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Toolbox]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=738</guid>
		<description><![CDATA[<p>As of yesterday the ILNumerics Optimization Toolbox is out and online! It&#8217;s been quite a challenge to bring everything together: some of the best algorithms, the convenience you as a user of ILNumerics expect and deserve, and the high performance requirements ILNumerics sets the scale on for. We believe that all these goals could be &#8230; <a href="https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/" class="more-link">Continue reading <span class="screen-reader-text">Directions to the ILNumerics Optimization Toolbox</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/">Directions to the ILNumerics Optimization Toolbox</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>As of yesterday the ILNumerics Optimization Toolbox is out and online! It&#8217;s been quite a challenge to bring everything together: some of the best algorithms, the convenience you as a user of ILNumerics expect and deserve, and the high performance requirements ILNumerics sets the scale on for. We believe that all these goals could be achieved quite greatly.</p>
<p><span id="more-738"></span></p>
<p>During a lengthy beta phase we received a whole bunch of precise and enormous helpful feedback from you. We really appreciate that and again would like to say thanks!</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Optim_Camel_LBFGS.png"><img class="aligncenter size-full wp-image-747" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Optim_Camel_LBFGS.png" alt="Optim_Camel_LBFGS" width="1026" height="868" /></a>ILNumerics Optimization Toolbox adds a number of functions to ILNumerics, useful to find solutions of common optimization problems. Since everything is nicely integrated into ILNumerics it helps you solve the problem easily and very efficiently. Optimization applications like the one shown as screenshot above can now get realized in a couple of minutes!</p>
<p>This blog post sheds some light on the very first steps for using the new Optimization Toolbox. It helps you to start quickly and lists some common documentation sources.</p>
<h2>Obtaining the Optimization Toolbox</h2>
<p>The optimization toolbox is available as a dedicated package and so must be individually purchased and installed. ILNumerics 4.6 or above is needed for that to work. Existing customers can evaluate the new toolbox by installing an extended trial on top of your existing ILNumerics Ultimate VS installation. Just <a href="mailto:sales@ilnumerics.net">let us know</a> and we will lead you the way to the download. Another option is the trial: it includes all toolboxes, hence you can start right away by <a href="http://ilnumerics.net/download.html">downloading</a> and installing a trial of ILNumerics Ultimate VS and get familiar with all optimization methods easily.</p>
<h2>Optimization Toolbox Setup</h2>
<p>The optimization toolbox obviously depends on the ILNumerics Computation Engine. It installs the managed assemblies ILNumerics.Optimization.dll into the GAC and also makes them available inside Visual Studio as reference to your application projects:</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-16_26_48-Reference-Manager-ConsoleApplication18.png"><img class="aligncenter size-full wp-image-740" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-16_26_48-Reference-Manager-ConsoleApplication18.png" alt="2015-01-14 16_26_48-Reference Manager - ConsoleApplication18" width="700" height="351" /></a>Afterwards, the ILNumerics.Optimization class is found in the ILNumerics namespace which commonly is included in your source files anyway. A super-mini but complete starting example in a fresh new C# console application could look as follows:</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using ILNumerics; 

namespace ConsoleApplication1 {
    class Program : ILMath {

        static ILRetArray&lt;double&gt; myObjFunc(ILInArray&lt;double&gt; A) {
            using (ILScope.Enter(A)) {
                return sum((A - 1) * A);
            }
        }
        static void Main(string[] args) {
            ILArray&lt;double&gt; M = Optimization.fmin(myObjFunc, ones(1,4));
            Console.WriteLine(M);
        }
    }
}

</pre>
<p>Note how we derived our console class from ILNumerics.ILMath! This allows us to omit the namespace.class identifier and &#8216;ILMath.sum&#8217; and &#8216;ILMath.ones&#8217; become just: &#8216;sum&#8217; and &#8216;ones&#8217;.</p>
<p>If you are lucky enough to use Visual Studio 2015, it will allow you the inclusion of the static ILNumerics.Optimization class into your &#8216;using&#8217; directives on top of your source code files also. This will inject all public functions of the Optimization class into your scope also which gives an even shorter syntax. &#8216;fmin&#8217; and all other optimization functions are now readily available right next to the common ILMath functions:</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-16_44_19-ConsoleApplication1-Debugging-Microsoft-Visual-Studio.png"><img class="aligncenter size-full wp-image-743" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-16_44_19-ConsoleApplication1-Debugging-Microsoft-Visual-Studio.png" alt="2015-01-14 16_44_19-ConsoleApplication1 (Debugging) - Microsoft Visual Studio" width="661" height="373" /></a>That&#8217;s it already! Happy optimizing!</p>
<h2>Optimization Examples</h2>
<p>A number of example applications have been added to the <a href="http://ilnumerics.net/examples.php">examples section</a>. Basically, they accompany the corresponding <a href="/ilnumerics-optimization-toolbox.html">online documentation</a> and let you follow the tutorials step by step on your own machine.</p>
<p>In order to start with an example application, you download the example as a zip package and extract it into a new folder on your local machine. Open the &#8216;*.csproj&#8217; contained in the example package with Visual Studio. You will notice missing references in the References node of your project in the Solution Explorer:</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-17_03_38-.png"><img class="aligncenter size-full wp-image-744" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2015-01-14-17_03_38-.png" alt="2015-01-14 17_03_38-" width="386" height="523" /></a>Just remove these old references and replace them with references to the files actually installed on your system – using the common method described above.</p>
<p>Hit F5 and run the example!</p>
<h2>Documentation</h2>
<p>The ILNumerics Optimization Toolbox online documentation is available here:</p>
<p><a href="http://ilnumerics.net/ilnumerics-optimization-toolbox.html">http://ilnumerics.net/ilnumerics-optimization-toolbox.html</a></p>
<p>The API /class documentation for all functions of ILNumerics.Optimization is available here:</p>
<p><a href="http://ilnumerics.net/apidoc/?topic=html/T_ILNumerics_Optimization.htm">http://ilnumerics.net/apidoc/?topic=html/T_ILNumerics_Optimization.htm</a></p>
<h2>Wrap up</h2>
<p>We gave a short introduction in how to obtain and install ILNumerics Optimization Toolbox for ILNumerics Computing Engine. We pointed you to the common places of examples and documentation.</p>
<p>If you run into trouble or have useful suggestions and feedback, <a href="/direct-support.html">let us know</a>! Contact <a href="mailto:sales@ilnumerics.net">sales@ilnumerics.net</a> for any licensing questions.</p>
<p><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2014-12-19-17_06_40-Iterations-BFGS_-8-L-BFGS_-22.png"><img class="aligncenter size-full wp-image-739" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/2014-12-19-17_06_40-Iterations-BFGS_-8-L-BFGS_-22.png" alt="2014-12-19 17_06_40-Iterations BFGS_ 8 L-BFGS_ 22" width="1026" height="805" /></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/">Directions to the ILNumerics Optimization Toolbox</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/directions-to-the-ilnumerics-optimization-toolbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ILNumerics for Scientists &#8211; An easy start</title>
		<link>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/#comments</comments>
		<pubDate>Wed, 07 Jan 2015 16:05:43 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[Quantum Mechanics]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=714</guid>
		<description><![CDATA[<p>Motivation I’ve been working as a scientist at universities for 10 years before deciding to go into industry. The one thing I hated most was coding. At the end of the day coding for scientists is like running for a football player. Obviously, you need it but it’s not what you’re here for. I really &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics for Scientists &#8211; An easy start</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">ILNumerics for Scientists &#8211; An easy start</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3>Motivation</h3>
<p style="text-align: justify;">I’ve been working as a scientist at universities for 10 years before deciding to go into industry. The one thing I hated most was coding. At the end of the day coding for scientists is like running for a football player. Obviously, you need it but it’s not what you’re here for.</p>
<p style="text-align: justify;">I really dreaded the coding and the debugging. So much precious time for something that was so clear on paper and I just wanted the solution of my equations to see whether my idea made sense or not. More often than not scientists find that their idea was not so great and now they had spent so much time coding just to find out that the idea didn’t work.<span id="more-714"></span></p>
<p style="text-align: justify;">To make things worse even in the case that the idea was good the code was typically in a scripted language like Python or Matlab and now needed to be rewritten in Fortran or C++. Isn’t there a better way of doing things? Isn’t there a way where the idea creation and the formulation is the bottle neck and not the coding? I could’ve spent so much more time on valuable thinking instead of senseless coding.</p>
<p style="text-align: justify;">Now, obviously, I’m going to tell you how ILNumerics does exactly that. And, obviously, I do that because I work for them. Still, this is my experience and this is how easy it was. And at the end of the day, you’re not going to buy our product because of this blog post, rather because you downloaded our <a href="http://ilnumerics.net/download.html">free trial</a> and convinced yourself.</p>
<h3 style="text-align: justify;">The Problem</h3>
<p style="text-align: justify;">Let’s start with one of the simplest problems in quantum mechanics – the particle in a box. This is a quantum mechanical particle in a potential-free box with an infinite potential outside the box. In other words, the particle is forced to stay within the box. Anybody unfamiliar with this problem can read the <a href="https://en.wikipedia.org/wiki/Particle_in_a_box">Wikipedia article </a>about this.</p>
<p style="text-align: justify;">The solution to this problem is well-known and can be found analytically. As always in quantum mechanics, the solution is quantized with infinitely many solutions – also known as states. Each of the solutions consists of a wave function associated with a corresponding energy.</p>
<p style="text-align: center;">$\Psi_n(x) = \sqrt{\frac{2}{L}} \sin(n \cdot \pi \cdot  x)$</p>
<p style="text-align: justify;">In the equation above $n$ designates the $n^{th}$ state and $L$ is the length of the box, set to 1 in our case.</p>
<h3 style="text-align: justify;">The Goal</h3>
<p style="text-align: justify;">My goal is to display the wave function and the probability density of a user-chosen state. I choose a simple problem and a simple goal because I’m just getting started. Obviously, this is not one of the problems I faced as a scientist in my earlier life, but it is a nice example.</p>
<h3 style="text-align: justify;">The Solution</h3>
<p style="text-align: justify;">Let’s start with the mathematical part. First I implemented the wave function for a given state. As the wave function is supposed to be plotted it is discretized over a mesh. Here is my body of my function:</p>
<pre class="brush: csharp; title: ; notranslate">
     ILArray&lt;double&gt; X = linspace&lt;double&gt;(0,1,MeshSize);
     ILArray&lt;double&gt; Y = sqrt(2.0)*sin(EVID*pi*X);
     return vertcat(X,Y);
</pre>
<p style="text-align: justify;">The parameter EVID is the eigenvector ID, i.e. an integer greater than 0 to identify which state should be calculated. I coded the same for the density, which basically means squaring the wave function stored in vector Y.</p>
<p>Done in less than 10 minutes!!!</p>
<h3>The Graphs</h3>
<p style="text-align: justify;">The rest is all about the presentation to the user. So I created a simple Windows Form with a numeric up/down counter (to allow the user to choose the state) and two panels for simple line plots. I just needed to wire all the components to make sure that the plots were rescaled and updated after the user changes the state. This took me some more time, because it was the first time for me. Still it took me only 60 minutes and done.</p>
<h3>The Result</h3>
<p style="text-align: justify;">Here you can find the result of my simple little program. You can download the <a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleBoxBest.zip" target="_blank">source code</a> and play with it. Have fun!</p>
<p style="text-align: center;"><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleInABox.png"><img class="alignnone wp-image-715 size-full" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleInABox.png" alt="ParticleInABox" width="900" height="603" /></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">ILNumerics for Scientists &#8211; An easy start</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# for 3D visualizations and Plotting in .NET</title>
		<link>https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/</link>
		<comments>https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/#comments</comments>
		<pubDate>Tue, 08 Oct 2013 13:58:27 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[2d]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[Math Library]]></category>
		<category><![CDATA[scientific computing]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=467</guid>
		<description><![CDATA[<p>2D and 3D Visualizations are an important feature for a wide range of domains: both software developers and scientists often need convenient visualization facilities to create interactive scenes and to make data visible. The ILNumerics math library brings powerful visualization features to C# and .NET: ILView, the ILNumerics Scene Graph API and its plotting engine. &#8230; <a href="https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/" class="more-link">Continue reading <span class="screen-reader-text">C# for 3D visualizations and Plotting in .NET</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/">C# for 3D visualizations and Plotting in .NET</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><strong>2D and 3D Visualizations are an important feature for a wide range of domains: both software developers and scientists often need convenient visualization facilities to create interactive scenes and to make data visible. The ILNumerics math library brings powerful visualization features to C# and .NET: ILView, the ILNumerics Scene Graph API and its plotting engine. We&#8217;d like to give an overview over our latest achievements.</strong></p>
<h2>ILView: a simple way to create interactive 3d visualizations</h2>
<p>We have created ILView as an extension to our interactive web component: It allows you to simply try out ILNumerics&#8217; 2d and 3d visualization features by chosing the output format .exe in our visualization examples. But that&#8217;s not all: ILView is also a general REPL for the evaluation of computational expressions using C# language. ILView is Open Source – find it on <a href="https://github.com/ilnumerics/ILView" target="_blank">GitHub</a>!</p>
<figure id="attachment_477" style="width: 500px;" class="wp-caption aligncenter"><a href="http://ilnumerics.net/blog/wp-content/uploads/2013/10/ilview-3d-visualization.png"><img class=" wp-image-477   " title="3D Visualization with ILView" src="http://ilnumerics.net/blog/wp-content/uploads/2013/10/ilview-3d-visualization-1024x551.png" alt="Screenshot of ILView" width="500" /></a><figcaption class="wp-caption-text">Using ILView for interactive 3D Visualization</figcaption></figure>
<h2>ILNumerics Scene Graph: realize complex visualizations in .NET</h2>
<p>The ILNumeric&#8217;s scene graph is the core of ILNumerics&#8217; visualization engine. No matter if you want to create complex interactive <a href="http://ilnumerics.net/Visualization-API.html">3D visualizations</a>, or if you aim at enhancing and re-configuring existing scenes in .NET: The ILNumerics scene graph offers a convenient way to realize stunning graphics with C#. It uses OpenGL, GDI, and it&#8217;s possible to export scenes into vector and pixel graphics.</p>
<figure id="attachment_478" style="width: 400px;" class="wp-caption aligncenter"><a href="http://ilnumerics.net/blog/wp-content/uploads/2013/10/3d-visualization-scene-graph.png"><img class=" wp-image-478  " title="Interactive Visualization, created with ILNumerics Scene Graph" src="http://ilnumerics.net/blog/wp-content/uploads/2013/10/3d-visualization-scene-graph-300x225.png" alt="Screenshot of an interactive 3D scene" width="400" /></a><figcaption class="wp-caption-text">Using C# for 3D visualizations: the ILNumerics Scene Graph</figcaption></figure>
<h2>Scientific Plotting: visualize your data using C#</h2>
<p>With ILNumerics’ visualization capabilities, C# becomes the language of choice for scientists, engineers and developers who need to visualize data: Our <a href="http://ilnumerics.net/plotting-api.html">plotting API</a> and different kinds of plotting types (contour plots, surface plots etc.) make easy work of creating beautiful scientific visualizations.</p>
<figure id="attachment_479" style="width: 400px;" class="wp-caption aligncenter"><a href="http://ilnumerics.net/blog/wp-content/uploads/2013/10/scientific-plotting-net.png"><img class=" wp-image-479 " title="3D Surface Plot, created with ILNumerics" src="http://ilnumerics.net/blog/wp-content/uploads/2013/10/scientific-plotting-net.png" alt="Screenshot of a Surface Plot in ILNumerics" width="400" /></a><figcaption class="wp-caption-text">Scientific Plotting in .NET: A Surface Plot created with ILNumerics</figcaption></figure>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/">C# for 3D visualizations and Plotting in .NET</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/3d-visualization-and-scientific-plotting-for-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
