<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>MKL absolute value Archives - CenterSpace</title>
	<atom:link href="https://www.centerspace.net/tag/mkl-absolute-value/feed" rel="self" type="application/rss+xml" />
	<link>https://www.centerspace.net/tag/mkl-absolute-value</link>
	<description>.NET numerical class libraries</description>
	<lastBuildDate>Tue, 01 Mar 2016 21:44:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>
<site xmlns="com-wordpress:feed-additions:1">104092929</site>	<item>
		<title>Absolute value of complex numbers</title>
		<link>https://www.centerspace.net/absolute-value-of-complex-numbers</link>
					<comments>https://www.centerspace.net/absolute-value-of-complex-numbers#comments</comments>
		
		<dc:creator><![CDATA[CenterSpace]]></dc:creator>
		<pubDate>Tue, 08 Mar 2011 19:51:14 +0000</pubDate>
				<category><![CDATA[MKL]]></category>
		<category><![CDATA[NMath]]></category>
		<category><![CDATA[abs complex number]]></category>
		<category><![CDATA[absolute value of a complex number]]></category>
		<category><![CDATA[BLAS absolute value]]></category>
		<category><![CDATA[MKL absolute value]]></category>
		<guid isPermaLink="false">http://www.centerspace.net/blog/?p=3277</guid>

					<description><![CDATA[<p><img class="excerpt" src="http://latex.codecogs.com/gif.latex?\left &#124;x \right &#124;_{l_1} = \left &#124;x_r \right &#124; + \left &#124;x_c \right &#124;" title="\left &#124;x \right &#124; = \left &#124;x_r \right &#124; + \left &#124;x_c \right &#124;" />  Max from <a href="http://www.slb.com/">Schlumberger</a> Fiber Optics came to us with an interesting bug report regarding the <tt>MaxAbsValue()</tt> and <tt>MaxAbsIndex()</tt> functions as applied to complex vectors in the <tt>NMathFunctions</tt> class.  Most of the time these methods worked as expected, but they would intermittently fail to correctly identify the maximum element in large vectors with similar elements.  The issue turned out to be the unusual definition for the absolute value of a complex number in the BLAS standard. </p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/absolute-value-of-complex-numbers">Absolute value of complex numbers</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Max Hadley from <a href="http://www.slb.com/">Schlumberger</a> in Southampton, UK came to us with an interesting bug report regarding the <tt>MaxAbsValue()</tt> and <tt>MaxAbsIndex()</tt> functions as applied to complex vectors in the <tt>NMathFunctions</tt> class.  Most of the time these methods worked as expected, but they would intermittently fail to correctly identify the maximum element in large vectors with similar elements.</p>
<p>In researching the MKL documentation we found that this was in fact not a problem from MKL&#8217;s <a href="http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/mklxe/mkl_manual_win_mac/bla/functn_iamax.htm">perspective</a>.  MKL uses the L1-norm, or <a href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan distance</a> from 0,  as a metric to compute the absolute value of a complex number.  This simply means that it adds together the absolute values of the real and imaginary components:</p>
<table style="margin-left: 120px; padding: 5px;">
<tr>
<td ><img decoding="async" src="http://latex.codecogs.com/gif.latex?\left |x \right |_{l_1} = \left |x_r \right | + \left |x_c \right |" title="\left |x \right | = \left |x_r \right | + \left |x_c \right |" /></td>
</tr>
</table>
<table style="margin-left: 5px; margin-top: -30px"><center></p>
<caption align="bottom" style="padding: 5px;">Absolute value of a complex number according to BLAS.</caption>
<p></center></p>
</table>
<p>We had expected the absolute value to be computed via the L2-norm, or <a href="https://en.wikipedia.org/wiki/Euclidean_distance">Euclidean distance</a> from zero, which is referred to in places as the <a href="http://mathworld.wolfram.com/VectorNorm.html">magnitude</a> metric.  Interestingly, MKL uses the L1-norm because that is the norm defined by the underlying BLAS standard, and apparently the original designers of BLAS choose that norm for computational efficiency.  This means that all BLAS-based linear algebra packages compute the norm of a complex vector in this way &#8211; and it&#8217;s probably not what most people expect.</p>
<p>This was a tricky bug to find for two reasons.  First, substituting one norm for the other did not elicit incorrect behavior often because the real component generally dominates the magnitude.  Second, the actual calculation of the absolute value of a complex number (rather than the maximum absolute value of a complex vector) has always been calculated using the L2-norm.</p>
<p>Now that we found the problem, we faced the unenviable task of trying to make our API consistent while interfacing with MKL and how it deals with finding the maximum absolute value element in a vector of complex numbers.  We started by suffixing all complex versions of min and max abs methods that use MKL and therefore use the L1-norm to compute the absolute value of complex numbers with a &#8216;1&#8217;:</p>
<pre lang="csharp">public static int MaxAbs1Index( FloatComplexVector v )
public static int MaxAbs1Value( FloatComplexVector v )
public static int MinAbs1Index( FloatComplexVector v )
public static int MinAbs1Value( FloatComplexVector v )
public static int MaxAbs1Index( DoubleComplexVector v )
public static int MaxAbs1Value( DoubleComplexVector v )
public static int MinAbs1Index( DoubleComplexVector v )
public static int MinAbs1Value( DoubleComplexVector v )</pre>
<p>And we have subsequently written new methods that compute the maximum and minimum absolute values of a complex vector according to the L2-norm, or Euclidean distance, of its elements.  Users should be aware that these methods do not use MKL:</p>
<pre lang="csharp">public static int MaxAbsIndex( FloatComplexVector v )
public static int MaxAbsValue( FloatComplexVector v )
public static int MinAbsIndex( FloatComplexVector v )
public static int MinAbsValue( FloatComplexVector v )
public static int MaxAbsIndex( DoubleComplexVector v )
public static int MaxAbsValue( DoubleComplexVector v )
public static int MinAbsIndex( DoubleComplexVector v )
public static int MinAbsValue( DoubleComplexVector v )</pre>
<p>We hope the change is intuitive and useful.</p>
<p>Darren</p>
<p>The post <a rel="nofollow" href="https://www.centerspace.net/absolute-value-of-complex-numbers">Absolute value of complex numbers</a> appeared first on <a rel="nofollow" href="https://www.centerspace.net">CenterSpace</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.centerspace.net/absolute-value-of-complex-numbers/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3277</post-id>	</item>
	</channel>
</rss>
