<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-839192421527479486</id><updated>2012-02-16T00:29:32.225-08:00</updated><title type='text'>Renan Cabrera L. PhD</title><subtitle type='html'>Diverse topics in physics, mathematics and scientific computing.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>94</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6848655158412809288</id><published>2012-02-12T00:02:00.000-08:00</published><updated>2012-02-14T11:28:36.984-08:00</updated><title type='text'>Conservation of Shannon information in classical mechanics</title><content type='html'>There are many places where to find the proof of the conservation of the quantum Shannon information under unitary evolution. However, I just could not find the equivalent proof that everybody talks in classical mechanics, so here it goes. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=S = - \int dxdp\, \rho\, \ln \rho" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?S = - \int dxdp\, \rho\, \ln \rho" title="S = - \int dxdp\, \rho\, \ln \rho" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=\dot{S} = - \int dxdp\, \dot{\rho}\, \ln \rho @plus; \dot{\rho}" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?\dot{S} = - \int dxdp\, \dot{\rho}\, \ln \rho + \dot{\rho}" title="\dot{S} = - \int dxdp\, \dot{\rho}\, \ln \rho + \dot{\rho}" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Lioville equation can be expressed in terms of a self-adjoint operator as observed by Koopman and von Neumann, such that&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=i \dot{\rho} = \mathcal{L} \rho" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?i \dot{\rho} = \mathcal{L} \rho" title="i \dot{\rho} = \mathcal{L} \rho" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Given that the Liouvillian follows the Leibniz rule, which is true for conservative systems &lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=\mathcal{L} f(\rho) = f' \mathcal{L}\rho" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?\mathcal{L} f(\rho) = f' \mathcal{L}\rho" title="\mathcal{L} f(\rho) = f' \mathcal{L}\rho" /&gt;&lt;/a&gt;&lt;br /&gt;it is now easy to prove that &lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=\dot{S} = 0" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?\dot{S} = 0" title="\dot{S} = 0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This fact is in complete contrast with respect to the thermodynamical entropy, which can be fundamentally irreversible.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-This entry was powered by http://www.codecogs.com/latex/eqneditor.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6848655158412809288?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6848655158412809288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2012/02/entropy-conservation-in-classical.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6848655158412809288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6848655158412809288'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2012/02/entropy-conservation-in-classical.html' title='Conservation of Shannon information in classical mechanics'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6990450255733141240</id><published>2012-02-09T13:31:00.000-08:00</published><updated>2012-02-10T08:24:43.365-08:00</updated><title type='text'>DUST</title><content type='html'>DUST stands for Differential Unitary Space Time coding. This coding method is used in the transmission of information from multiple antennas to multiple antennas. &lt;br /&gt;&lt;br /&gt;The transmission of information in a block can be modelled with the following equation&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=X = \sqrt{\rho} S H @plus; W" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?X = \sqrt{\rho} S H + W" title="X = \sqrt{\rho} S H + W" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;where  S is the input matrix, H is the channel matrix, \rho is a scalar coefficient that modulates the channel and W is the noise.&lt;br /&gt;&lt;br /&gt;DUST encodes the information in a unitary matrix U_n, which is indirectly encoded through a sequence of two S unitary blocks as&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=S_n = U_n S_{n-1}" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?S_n = U_n S_{n-1}" title="S_n = U_n S_{n-1}" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If H is full-rank and the channel does not change significantly in the time the two blocks are transmitted. The unitary matrix U can be recovered from the sequence of two received unitary blocks  X without! the need to know the channel H as&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=X_n = U_n X_{n-1} @plus; W_n^{\prime}" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?X_n = U_n X_{n-1} + W_n^{\prime}" title="X_n = U_n X_{n-1} + W_n^{\prime}" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;where the new noise is defined as&lt;br /&gt;&lt;a href="http://www.codecogs.com/eqnedit.php?latex=W_n^{\prime} = W_n - U_n W_{n-1}" target="_blank"&gt;&lt;img src="http://latex.codecogs.com/gif.latex?W_n^{\prime} = W_n - U_n W_{n-1}" title="W_n^{\prime} = W_n - U_n W_{n-1}" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-This entry was powered by http://www.codecogs.com/latex/eqneditor.php&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6990450255733141240?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6990450255733141240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2012/02/dust.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6990450255733141240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6990450255733141240'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2012/02/dust.html' title='DUST'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-282654532128074012</id><published>2012-02-07T11:58:00.000-08:00</published><updated>2012-02-11T20:07:23.911-08:00</updated><title type='text'>Random Unitary Matrices</title><content type='html'>The generation of random unitary matrices has many applications in many fields.&lt;br /&gt;The simplest method is based on the QR decomposition of a random complex matrix with independent elements following a Normal distribution.&lt;br /&gt;&lt;br /&gt;In Mathematica one can generate a random complex number with Normal distribution for both the real and imaginary parts with the following function &lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;NormalRandomComplex[] := (#[[1]] + #[[2]]*I) &amp;amp;@&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp; RandomReal[MultinormalDistribution[{0, 0}, {{1, 0}, {0, 1}}]]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;where &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;{0, 0}&lt;/span&gt; specifies the origin and &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;{{1, 0}, {0, 1}}&lt;/span&gt; the covariance matrix (standard deviation 1)&lt;br /&gt;&lt;br /&gt;The function that generates the random n x n unitary matrix is &lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;RandomUnitaryMatrix[n_] := Module[{z, q, r},&lt;br /&gt;&amp;nbsp; z = Table[NormalRandomComplex[], {n}, {n}];&lt;br /&gt;&amp;nbsp; {q, r} = QRDecomposition[z];&lt;br /&gt;&amp;nbsp; q.DiagonalMatrix[Sign[Tr[r, List]]]&lt;/div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;] &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this code, the QR decomposition of the complex random matrix with normal distribution outputs a unitary matrix "q" and a triangular matrix "r". The sought random unitary matrix is a correction of "q", which must be multiplied by a diagonal matrix filled with 1 and -1 according to the sign of the corresponding diagonal element of "r". &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-282654532128074012?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/282654532128074012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2012/02/random-unitary-matrices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/282654532128074012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/282654532128074012'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2012/02/random-unitary-matrices.html' title='Random Unitary Matrices'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5920061947779538777</id><published>2012-01-19T12:42:00.000-08:00</published><updated>2012-01-19T12:42:00.350-08:00</updated><title type='text'>New numerical algorithms</title><content type='html'>Two recent developments on numerical analysis have called my attention&lt;br /&gt;&lt;br /&gt;A new very efficient sparse Fourier transform &lt;br /&gt;&lt;a href="http://web.mit.edu/newsoffice/2012/faster-fourier-transforms-0118.html"&gt;http://web.mit.edu/newsoffice/2012/faster-fourier-transforms-0118.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A significantly faster algorithm for matrix multiplication&lt;br /&gt;&lt;a href="http://www.newscientist.com/article/mg21228422.500-mathematical-matrix-multiplier-sees-first-advance-in-24-years.html"&gt;http://www.newscientist.com/article/mg21228422.500-mathematical-matrix-multiplier-sees-first-advance-in-24-years.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5920061947779538777?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5920061947779538777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2012/01/new-numerical-algorithms.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5920061947779538777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5920061947779538777'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2012/01/new-numerical-algorithms.html' title='New numerical algorithms'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3672665561438649979</id><published>2011-12-08T20:31:00.000-08:00</published><updated>2011-12-08T20:33:26.861-08:00</updated><title type='text'>De Broglie waves and relativity</title><content type='html'>Another extremely interesting connection between relativity and quantum mechanics is that the quantum De Broglie waves can be understood as an effect of the relativistic desynchronization of clocks given that the clocks rotate with a frequency proportional to the total energy of the particle.&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;br /&gt;Imagine a train with a long chain of synchronized clocks from one extreme to the other with the synchronization established according to an observer moving along with the train. Another person standing still on the train station will conclude that the clocks are actually not synchronized (what he would see is a different thing). If the train is moving to the right, the clocks on the right will be ahead respect to the clocks on the left. The De Broglie wave length will be the length that stretches 12 hours of desynchronization.&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div class="citationLine"&gt;&lt;span class="italic"&gt;[1] W. Baylis, Canadian Journal of Physics&lt;/span&gt;&lt;a href="http://www.nrcresearchpress.com/doi/abs/10.1139/p07-121"&gt;, 2007, 85:(12) 1317-1323, 10.1139/p07-121&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3672665561438649979?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3672665561438649979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/12/de-broglie-waves-and-relativity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3672665561438649979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3672665561438649979'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/12/de-broglie-waves-and-relativity.html' title='De Broglie waves and relativity'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1603718264835271027</id><published>2011-12-06T11:48:00.000-08:00</published><updated>2012-02-10T13:31:10.409-08:00</updated><title type='text'>The ball is round!</title><content type='html'>The first thing we learn in a course of relativity is the relativistic length contraction effect for moving objects relative to an observer. However, what one would actually see is a different thing ! because another important effect must be considered; the time required for the light to arrive from the different points of the observed object to our eyes. The combined effect of the Lorentz contraction along with the time delay was investigated reaching to curious results. For example, a relativistic ball remains with a round appearance!, as discussed by Penrose in the following paper &lt;br /&gt;&lt;br /&gt;&lt;a href="http://adsabs.harvard.edu/abs/1959PCPS...55..137P"&gt;http://adsabs.harvard.edu/abs/1959PCPS...55..137P&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A nice visulaization can be found at&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.spacetimetravel.org/ueberblick/ueberblick1.html"&gt;http://www.spacetimetravel.org/ueberblick/ueberblick1.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1603718264835271027?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1603718264835271027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/12/ball-is-round.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1603718264835271027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1603718264835271027'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/12/ball-is-round.html' title='The ball is round!'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2975475705843321314</id><published>2011-11-07T10:50:00.000-08:00</published><updated>2011-11-07T10:59:51.847-08:00</updated><title type='text'>Thermodynamical entropy and Shannon information</title><content type='html'>The moment I read about information theory I thought that it was evident that the thermodynamical entropy&amp;nbsp; was completely equivalent; the same thing, just measured in different units with the Boltzmann constant in the middle. I was shocked when I read that this issue is still under debate today. There are two books that share the idea that the thermodynamical entropy is fundamentally a measure of information and expose the controversy respect with the opposite view:&amp;nbsp; &lt;br /&gt;&lt;ul&gt;&lt;li&gt;A Farewell To Entropy: Statistical Thermodynamics based on Information. By Arieh Ben-Naim&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;E.T. Jaynes: Papers on Probability, Statistics and Statistical Physics. By R.D. Rosenkrantz (Editor)&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1 class="parseasinTitle "&gt;&lt;span id="btAsinTitle"&gt;&lt;/span&gt;&lt;/h1&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2975475705843321314?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2975475705843321314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/11/thermodynamical-entropy-and-shannon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2975475705843321314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2975475705843321314'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/11/thermodynamical-entropy-and-shannon.html' title='Thermodynamical entropy and Shannon information'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-206215599336630265</id><published>2011-11-01T14:47:00.000-07:00</published><updated>2011-11-10T12:25:28.828-08:00</updated><title type='text'>PyNewtonCUDA</title><content type='html'>Denys Bondar and I, just released to the public: PyNewtonCUDA&lt;br /&gt;&lt;br /&gt;&lt;a href="https://code.google.com/p/py-newton-cuda/"&gt;https://code.google.com/p/py-newton-cuda/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This program is able to propagate a large number of classical particles using&amp;nbsp; GPU technology. The code is written in Python and PyCUDA, which allows to write high-level code for GPU programming while maintaining very high performance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can download the code with the following command&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;svn checkout https://py-newton-cuda.google.com/svn/trunk PyNewtonCUDA&lt;/tt&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-206215599336630265?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/206215599336630265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/11/pynewtoncuda.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/206215599336630265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/206215599336630265'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/11/pynewtoncuda.html' title='PyNewtonCUDA'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-840893721648404829</id><published>2011-06-24T23:31:00.000-07:00</published><updated>2011-11-05T14:43:49.519-07:00</updated><title type='text'>Classical Relativistic Many-Body Dynamics</title><content type='html'>I found a book on the interesting and very difficult topic of many-body classical relativistic theory &lt;br /&gt;&lt;h1 class="headline" style="font-weight: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Classical Relativistic Many-Body Dynamics&lt;/b&gt;&lt;/span&gt;&lt;/h1&gt;&lt;b&gt;Trump&lt;/b&gt;, M.A., &lt;b&gt;Schieve&lt;/b&gt;, W.C&lt;br /&gt;Springer, &lt;a class="greyRaquoLink" href="http://www.springer.com/series/6001"&gt;Fundamental  Theories of Physics&lt;/a&gt;, Vol. 103&lt;br /&gt;&lt;br /&gt;This relativistic covariant many-body formulation overcomes the no go theorem by Jordan and Sudarshan [1] by giving up the locality of the interactions and the individual mass-shell conditions. These are not simply cosmetic upgrades but have serious consequences on how we should understand classical physics.&lt;br /&gt;&lt;br /&gt;"The single particle has no significance; it is the whole system that counts" --Lanczos&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[1] FROM CLASSICAL TO&lt;br /&gt;QUANTUM MECHANICS&lt;br /&gt;Giampiero Esposito, Giuseppe Marmo&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-840893721648404829?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/840893721648404829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/06/classical-relativistic-many-body.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/840893721648404829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/840893721648404829'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/06/classical-relativistic-many-body.html' title='Classical Relativistic Many-Body Dynamics'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3453348016982898001</id><published>2011-06-03T05:33:00.000-07:00</published><updated>2011-06-04T03:43:53.751-07:00</updated><title type='text'>Geo-coordinates for citations on scientific papers</title><content type='html'>Here I draw a map for the places that either published a paper about the &lt;i&gt;Bures measure&lt;/i&gt; or were referenced by somebody who made a paper about the &lt;i&gt;Bures measure&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-8Ay6JjA0QX4/TejT_AUkd_I/AAAAAAAAAI4/_Zjt1iu63Ko/s1600/BuresGoeCoordinates.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="132" src="http://2.bp.blogspot.com/-8Ay6JjA0QX4/TejT_AUkd_I/AAAAAAAAAI4/_Zjt1iu63Ko/s320/BuresGoeCoordinates.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;The corresponding plot with the citations as links was created by my brother Ruben Cabrera, shown next&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-WFi32yT2yZY/TeoKDH7neMI/AAAAAAAAAI8/U75Db5q_oxE/s1600/citations_buresmeasure.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="133" src="http://1.bp.blogspot.com/-WFi32yT2yZY/TeoKDH7neMI/AAAAAAAAAI8/U75Db5q_oxE/s320/citations_buresmeasure.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The total number of papers in consideration were 662. The extraction of coordinates from heterogeneous references is an expensive computation, so I do not expect to make more of them just for fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3453348016982898001?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3453348016982898001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/06/geo-coordinates-for-citations-on.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3453348016982898001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3453348016982898001'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/06/geo-coordinates-for-citations-on.html' title='Geo-coordinates for citations on scientific papers'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-8Ay6JjA0QX4/TejT_AUkd_I/AAAAAAAAAI4/_Zjt1iu63Ko/s72-c/BuresGoeCoordinates.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7824017487473340731</id><published>2011-05-19T17:07:00.000-07:00</published><updated>2011-05-19T18:13:11.444-07:00</updated><title type='text'>Mathematica CDF documents</title><content type='html'>This is my first Mathematica cdf document on the Internet.&lt;br /&gt;The most remarkable feature of a cdf document is that it can be posted on a web site and evaluated by anybody with a web browser and  the freely available &lt;a href="http://www.wolfram.com/cdf-player/"&gt;cdf player plugin&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img alt="Graph demo" border="0" height="320" id="Graph_applet" src="http://dl.dropbox.com/u/24239307/graphs.png" width="290" /&gt;&lt;br /&gt;Note.- Unfortunately, it only works on Windows and Mac.&lt;br /&gt;&lt;script src="http://www.wolfram.com/cdf-player/plugin/v1.0/cdfplugin.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script type="text/javascript"&gt;// &lt;![CDATA[var cdf = new cdf_plugin();cdf.addCDFObject("Graph_applet", "http://dl.dropbox.com/u/24239307/graphs.cdf", 603,609);// ]]&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7824017487473340731?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7824017487473340731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/05/mathematica-cdf-documents.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7824017487473340731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7824017487473340731'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/05/mathematica-cdf-documents.html' title='Mathematica CDF documents'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7658526596180414178</id><published>2011-05-13T12:37:00.000-07:00</published><updated>2011-05-13T12:37:02.327-07:00</updated><title type='text'>Bibliographic Graphs Time-Line</title><content type='html'>Different colors for different publication dates. Dark green for the oldest to dark purple to the latest&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Bures measue&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-rppag7rfhvA/Tc2H9KvZkrI/AAAAAAAAAIY/FcV-ZX5PqnE/s1600/measure-bures-time.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="184" src="http://3.bp.blogspot.com/-rppag7rfhvA/Tc2H9KvZkrI/AAAAAAAAAIY/FcV-ZX5PqnE/s320/measure-bures-time.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-muohSNCVkQ4/Tc2IAvOQFnI/AAAAAAAAAIc/wJAv6gxcDlk/s1600/measure-haar-time.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Haar measure&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-muohSNCVkQ4/Tc2IAvOQFnI/AAAAAAAAAIc/wJAv6gxcDlk/s1600/measure-haar-time.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="274" src="http://1.bp.blogspot.com/-muohSNCVkQ4/Tc2IAvOQFnI/AAAAAAAAAIc/wJAv6gxcDlk/s320/measure-haar-time.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7658526596180414178?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7658526596180414178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs-time-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7658526596180414178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7658526596180414178'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs-time-line.html' title='Bibliographic Graphs Time-Line'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-rppag7rfhvA/Tc2H9KvZkrI/AAAAAAAAAIY/FcV-ZX5PqnE/s72-c/measure-bures-time.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8201099866357311097</id><published>2011-05-10T17:26:00.000-07:00</published><updated>2011-05-10T17:26:43.046-07:00</updated><title type='text'>Bibliographic Graphs</title><content type='html'>Continuing with bibliographic graphs.&lt;br /&gt;Here I combine the graphs from the &lt;span style="color: lime;"&gt;Bures measure&lt;/span&gt; in green and the&lt;span style="color: red;"&gt; Haar measure&lt;/span&gt; in red, where the publications that are common in both are in orange&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/--IuYRV9lqzk/TcnXJwpHnQI/AAAAAAAAAII/5VxzHBVxQsU/s1600/measure-bures-haar.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://4.bp.blogspot.com/--IuYRV9lqzk/TcnXJwpHnQI/AAAAAAAAAII/5VxzHBVxQsU/s320/measure-bures-haar.gif" width="300" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8201099866357311097?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8201099866357311097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs_10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8201099866357311097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8201099866357311097'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs_10.html' title='Bibliographic Graphs'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/--IuYRV9lqzk/TcnXJwpHnQI/AAAAAAAAAII/5VxzHBVxQsU/s72-c/measure-bures-haar.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4748266181946553448</id><published>2011-05-08T04:59:00.000-07:00</published><updated>2011-05-10T15:48:35.381-07:00</updated><title type='text'>Bibliographic Graphs</title><content type='html'>I just made a &lt;i&gt;Mathematica&lt;/i&gt; program to generate the citation graph for scientific academic publications given a specific &lt;i&gt;keyword&lt;/i&gt; (and some upper limit on the number of publications to treat). Some examples for three areas of my own interest are shown below&lt;br /&gt;&lt;ul&gt;&lt;li&gt;"Bures measure"&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-BFtbG9yGlr4/TcnAdv--IjI/AAAAAAAAAIE/tQnS3J0ex60/s1600/buresmeasure.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-BFtbG9yGlr4/TcnAdv--IjI/AAAAAAAAAIE/tQnS3J0ex60/s320/buresmeasure.gif" width="315" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The same job done for&amp;nbsp; "Haar measure"&amp;nbsp; &lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-hSwHHuZaC8g/TcfK0Ax-vxI/AAAAAAAAAH8/h0BaPLmW0_0/s1600/haarmeasure.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/-hSwHHuZaC8g/TcfK0Ax-vxI/AAAAAAAAAH8/h0BaPLmW0_0/s320/haarmeasure.gif" width="311" /&gt;&lt;/a&gt;&lt;/div&gt;It seems that the research done for the "Haar measure" is made of several unconnected niches. However, I expect that they will find some connection as I let the program run for more time.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;One final example for "Quantum control"&lt;/li&gt;&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-DUl7hRNdgQo/TcjwDS06BaI/AAAAAAAAAIA/X4BMd3Cu0yQ/s1600/qcontrol.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="216" src="http://4.bp.blogspot.com/-DUl7hRNdgQo/TcjwDS06BaI/AAAAAAAAAIA/X4BMd3Cu0yQ/s320/qcontrol.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Bibliographic research is now easier because I can put the mouse on the top of each node and see what paper is that. Something nice would be to output the whole bibtex file. &lt;br /&gt;&lt;br /&gt;Acknowledgements: This program was made possible thanks to the help of my friend &lt;a href="http://www.hightechdreams.com/main.php?keywords=algorithm"&gt;Josh Greig.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4748266181946553448?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4748266181946553448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4748266181946553448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4748266181946553448'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/05/bibliographic-graphs.html' title='Bibliographic Graphs'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-BFtbG9yGlr4/TcnAdv--IjI/AAAAAAAAAIE/tQnS3J0ex60/s72-c/buresmeasure.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4708968653881140977</id><published>2011-05-01T13:19:00.000-07:00</published><updated>2011-05-01T17:03:04.068-07:00</updated><title type='text'>Extracting data from a pdf file</title><content type='html'>There are a few quite expensive commercial programs for extracting data from pdf files, but a few lines of Mathematica code may be able to do the job for most cases. For example, the following file with&amp;nbsp; many pages&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-m7wg9uiEoMU/Tb29kJLddDI/AAAAAAAAAHw/8Z8k-ilm08I/s1600/pdf-file.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="179" src="http://1.bp.blogspot.com/-m7wg9uiEoMU/Tb29kJLddDI/AAAAAAAAAHw/8Z8k-ilm08I/s320/pdf-file.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;results in the following table&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ffNwZScNhN0/Tb2_PDYHTmI/AAAAAAAAAH0/4rwk-BInask/s1600/table1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="179" src="http://3.bp.blogspot.com/-ffNwZScNhN0/Tb2_PDYHTmI/AAAAAAAAAH0/4rwk-BInask/s320/table1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;Note.- This method works for text-searchable pdf files. Otherwise, this would be an image processing job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4708968653881140977?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4708968653881140977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/05/extracting-data-from-pdf-file.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4708968653881140977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4708968653881140977'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/05/extracting-data-from-pdf-file.html' title='Extracting data from a pdf file'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-m7wg9uiEoMU/Tb29kJLddDI/AAAAAAAAAHw/8Z8k-ilm08I/s72-c/pdf-file.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1440295176934477436</id><published>2011-04-21T14:34:00.000-07:00</published><updated>2011-04-29T21:04:33.345-07:00</updated><title type='text'>Mathematica as a C code generator</title><content type='html'>&lt;i&gt;Mathematica&lt;/i&gt; is able to generate C code ready to be compiled and ultimately capable to produce a stand alone executable file. Nice !. There are restrictions on the extent of what can be be processed in this way but it can be really useful in practice as it is right now. &lt;br /&gt;&lt;br /&gt;The generation of the executable can be done within Mathematica or outside Mathematica. The Mathematica 8.0 help for my Linux Fedora 64bits requires a minor adjustment in order to work. For Linux systems: &lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;"Libraries" -&amp;gt; "WolframRTL_Static_Minimal.lib"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;must be replaced by&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=":73" style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;"Libraries" -&amp;gt; "WolframRTL_Static_Minimal"&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;(Thanks to Abdul Dakkak for helping on this)&lt;br /&gt;&lt;br /&gt;How do we compile the generated code outside Mathematica? This issue is detailed next&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;The Mathematica code that generates the C code for a simple example taken from the help is&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre&gt;code =&lt;br /&gt;&amp;nbsp; CProgram[&lt;br /&gt;&amp;nbsp;&amp;nbsp; CInclude["stdio.h"],&lt;br /&gt;&amp;nbsp;&amp;nbsp; CInclude["compute.h"],&lt;br /&gt;&amp;nbsp;&amp;nbsp; CFunction["int", &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "main", {{"int", "argc"}, {"char", &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CDereference[CArray["arg", {}]]}},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CBlock[{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CDeclare["double", CAssign["num1", 20.4]],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CDeclare["double", "num2"],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CDeclare["WolframLibraryData", &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CAssign["libData", &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CCall["WolframLibraryData_new", {"WolframLibraryVersion"}]]],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CCall["Initialize_compute", {"libData"}],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CCall["compute", {"libData", "num1", CAddress["num2"]}],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CCall["printf", {CString["%5.2f\n"], "num2"}],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CCall["WolframLibraryData_free", {"libData"}],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CReturn[0]}]]&lt;br /&gt;&amp;nbsp;&amp;nbsp; ];&lt;br /&gt;cStr = ToCCodeString[code]&lt;br /&gt;&lt;br /&gt;mainSource = Export[FileNameJoin[{outDir, "main.c"}], cStr, "Text"]&lt;br /&gt;&lt;br /&gt;c = Compile[{{x}}, x^2];&lt;br /&gt;CCodeGenerate[c, "compute", FileNameJoin[{outDir, "compute.c"}], &lt;br /&gt;  "CodeTarget" -&amp;gt; "WolframRTL"];&lt;br /&gt;CCodeGenerate[c, "compute", FileNameJoin[{outDir, "compute.h"}], &lt;br /&gt;  "CodeTarget" -&amp;gt; "WolframRTLHeader"];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;where &lt;br /&gt;&lt;pre&gt;outDir&lt;/pre&gt;must be defined according the user's desires&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;ul&gt;&lt;li&gt;The generated main.c file with a minor manual retouching in the printf function is&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;&lt;br /&gt;#include "compute.h"&lt;br /&gt;&lt;br /&gt;#include "WolframRTL.h"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;arg&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;double&lt;/span&gt; num1&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="float"&gt; 20.4&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; num2&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;WolframLibraryData libData&lt;span class="operator"&gt; =&lt;/span&gt; WolframLibraryData_new&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryVersion&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;Initialize_compute&lt;span class="operator"&gt;(&lt;/span&gt;libData&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;compute&lt;span class="operator"&gt;(&lt;/span&gt;libData&lt;span class="operator"&gt;,&lt;/span&gt; num1&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;num2&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"%5.2f\n"&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; num2&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;WolframLibraryData_free&lt;span class="operator"&gt;(&lt;/span&gt;libData&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;ul&gt;&lt;li&gt;The generated file compute.c is&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include "math.h"&lt;br /&gt;&lt;br /&gt;#include "WolframRTL.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;static&lt;/span&gt; WolframCompileLibrary_Functions funStructCompile&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;&lt;br /&gt;static&lt;/span&gt; mbool initialize&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#include "compute.h"&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;DLLEXPORT&lt;span class="type"&gt; int&lt;/span&gt; Initialize_compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;if&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt; initialize&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;funStructCompile&lt;span class="operator"&gt; =&lt;/span&gt; libData&lt;span class="operator"&gt;-&amp;gt;&lt;/span&gt;compileLibraryFunctions&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;initialize&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DLLEXPORT&lt;span class="type"&gt; void&lt;/span&gt; Uninitialize_compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;initialize&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;initialize&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DLLEXPORT&lt;span class="type"&gt; int&lt;/span&gt; compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;,&lt;/span&gt; mreal A1&lt;span class="operator"&gt;,&lt;/span&gt; mreal&lt;span class="operator"&gt; *&lt;/span&gt;Res&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;mreal R0_0&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;mreal R0_1&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;R0_0&lt;span class="operator"&gt; =&lt;/span&gt; A1&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;R0_1&lt;span class="operator"&gt; =&lt;/span&gt; R0_0&lt;span class="operator"&gt; *&lt;/span&gt; R0_0&lt;span class="operator"&gt;;&lt;br /&gt;*&lt;/span&gt;Res&lt;span class="operator"&gt; =&lt;/span&gt; R0_1&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;funStructCompile&lt;span class="operator"&gt;-&amp;gt;&lt;/span&gt;WolframLibraryData_cleanUp&lt;span class="operator"&gt;(&lt;/span&gt;libData&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;ul&gt;&lt;li&gt;The generated file compute .h is&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include "WolframLibrary.h"&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;EXTERN_C DLLEXPORT&lt;span class="type"&gt; int&lt;/span&gt; Initialize_compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;EXTERN_C DLLEXPORT&lt;span class="type"&gt; void&lt;/span&gt; Uninitialize_compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;EXTERN_C DLLEXPORT&lt;span class="type"&gt; int&lt;/span&gt; compute&lt;span class="operator"&gt;(&lt;/span&gt;WolframLibraryData libData&lt;span class="operator"&gt;,&lt;/span&gt; mreal A1&lt;span class="operator"&gt;,&lt;/span&gt; mreal&lt;span class="operator"&gt; *&lt;/span&gt;Res&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;ul&gt;&lt;li&gt;Finally, the Makefile that takes care of the compilation is&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;pre&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;MATHEMATICA_INCLUDE_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;local&lt;span class="operator"&gt;/&lt;/span&gt;Wolfram&lt;span class="operator"&gt;/&lt;/span&gt;Mathematica&lt;span class="operator"&gt;/&lt;/span&gt;&lt;span class="float"&gt;8.0&lt;/span&gt;&lt;span class="operator"&gt;/&lt;/span&gt;SystemFiles&lt;span class="operator"&gt;/&lt;/span&gt;IncludeFiles&lt;span class="operator"&gt;/&lt;/span&gt;C&lt;br /&gt;&lt;br /&gt;MATHEMATICA_LIB_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;local&lt;span class="operator"&gt;/&lt;/span&gt;Wolfram&lt;span class="operator"&gt;/&lt;/span&gt;Mathematica&lt;span class="operator"&gt;/&lt;/span&gt;&lt;span class="float"&gt;8.0&lt;/span&gt;&lt;span class="operator"&gt;/&lt;/span&gt;SystemFiles&lt;span class="operator"&gt;/&lt;/span&gt;Libraries&lt;span class="operator"&gt;/&lt;/span&gt;Linux&lt;span class="operator"&gt;-&lt;/span&gt;x86&lt;span class="operator"&gt;-&lt;/span&gt;&lt;span class="int"&gt;64&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a&lt;span class="operator"&gt;.&lt;/span&gt;out&lt;span class="operator"&gt;:&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;c compute&lt;span class="operator"&gt;.&lt;/span&gt;o&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;} -&lt;/span&gt;I$&lt;span class="operator"&gt;{&lt;/span&gt;MATHEMATICA_INCLUDE_PATH&lt;span class="operator"&gt;} -&lt;/span&gt;L$&lt;span class="operator"&gt;{&lt;/span&gt;MATHEMATICA_LIB_PATH&lt;span class="operator"&gt;} -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lWolframRTL&lt;span class="operator"&gt; -&lt;/span&gt;lmkl_intel_lp64&lt;span class="operator"&gt; -&lt;/span&gt;lmkl_intel_thread&lt;span class="operator"&gt; -&lt;/span&gt;lmkl_core&lt;span class="operator"&gt; -&lt;/span&gt;liomp5&lt;span class="operator"&gt; -&lt;/span&gt;pthread compute&lt;span class="operator"&gt;.&lt;/span&gt;o&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt;&lt;br /&gt;compute&lt;span class="operator"&gt;.&lt;/span&gt;o&lt;span class="operator"&gt;:&lt;/span&gt; compute&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;} -&lt;/span&gt;c&lt;span class="operator"&gt; -&lt;/span&gt;I$&lt;span class="operator"&gt;{&lt;/span&gt;MATHEMATICA_INCLUDE_PATH&lt;span class="operator"&gt;}  -&lt;/span&gt;L$&lt;span class="operator"&gt;{&lt;/span&gt;MATHEMATICA_LIB_PATH&lt;span class="operator"&gt;}&lt;/span&gt;  compute&lt;span class="operator"&gt;.&lt;/span&gt;c &lt;/pre&gt;&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Of course, make sure that the libraries are in the right place and eventually you will need to add the path of the Mathematica libraries in&amp;nbsp; &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ld.so.conf&lt;/span&gt; and apply &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;/sbin/ldconfig&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;hr /&gt;&lt;hr /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;ul style="font-family: inherit;"&gt;&lt;li&gt;A more elaborated example taking a real matrix input and a real matrix output is &lt;a href="https://docs.google.com/leaf?id=0B6kZZ7ml-th8MjliNDY1YzMtZDg0My00M2EwLWIyOGMtMGJkNjY0MDgxNDBl&amp;amp;hl=en"&gt;here&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-family: inherit;"&gt;A similar example implemented for complex matrices &lt;/span&gt;&lt;a href="https://docs.google.com/leaf?id=0B6kZZ7ml-th8YWYxZjVjZDUtNTdiOC00NWY0LTlkOWQtYzc1OTdmOWEwODll&amp;amp;hl=en" style="font-family: inherit;"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1440295176934477436?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1440295176934477436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/04/mathematica-as-c-code-generator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1440295176934477436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1440295176934477436'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/04/mathematica-as-c-code-generator.html' title='Mathematica as a C code generator'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6029886627326857517</id><published>2011-04-20T23:47:00.000-07:00</published><updated>2011-04-20T23:49:31.397-07:00</updated><title type='text'>GDP per energy consumption</title><content type='html'>Here, the world map for the GDP per unit of energy consumption. The world map has so much variation of this index that I had to make a log plot&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-qtLrmUvPCu0/Ta_Sl-Tg3hI/AAAAAAAAAHo/FVDh37yxVVk/s1600/WorldMapGDPperEnergy.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="178" src="http://4.bp.blogspot.com/-qtLrmUvPCu0/Ta_Sl-Tg3hI/AAAAAAAAAHo/FVDh37yxVVk/s320/WorldMapGDPperEnergy.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;In the case of the American continent, the linear scale is better&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-YtRBWHAw3cE/Ta_S3YXK_pI/AAAAAAAAAHs/1F6dkkmIUfk/s1600/AmericaMapGDPperEnergy.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="290" src="http://2.bp.blogspot.com/-YtRBWHAw3cE/Ta_S3YXK_pI/AAAAAAAAAHs/1F6dkkmIUfk/s320/AmericaMapGDPperEnergy.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6029886627326857517?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6029886627326857517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/04/gdp-per-energy-consumption.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6029886627326857517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6029886627326857517'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/04/gdp-per-energy-consumption.html' title='GDP per energy consumption'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-qtLrmUvPCu0/Ta_Sl-Tg3hI/AAAAAAAAAHo/FVDh37yxVVk/s72-c/WorldMapGDPperEnergy.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3883700633682981489</id><published>2011-04-17T01:46:00.000-07:00</published><updated>2011-04-17T01:48:30.951-07:00</updated><title type='text'>Energy consumption per capita</title><content type='html'>I pulled out some data from Wolfram Alpha to make the following world map of the energy consumption per capita&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-RCkSj6TAlqE/TaqoXrr2L3I/AAAAAAAAAHg/bAQsAqHNbsg/s1600/WorldMapPlotEnergy.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://3.bp.blogspot.com/-RCkSj6TAlqE/TaqoXrr2L3I/AAAAAAAAAHg/bAQsAqHNbsg/s320/WorldMapPlotEnergy.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;A close up of America is also interesting&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-dJkskE2jwK8/TaqpV2pn15I/AAAAAAAAAHk/R9MOu2xCqEc/s1600/AmericaMapPlotEnergy.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="295" src="http://2.bp.blogspot.com/-dJkskE2jwK8/TaqpV2pn15I/AAAAAAAAAHk/R9MOu2xCqEc/s320/AmericaMapPlotEnergy.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3883700633682981489?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3883700633682981489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/04/energy-consumption-per-capita.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3883700633682981489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3883700633682981489'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/04/energy-consumption-per-capita.html' title='Energy consumption per capita'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-RCkSj6TAlqE/TaqoXrr2L3I/AAAAAAAAAHg/bAQsAqHNbsg/s72-c/WorldMapPlotEnergy.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8305488288160721786</id><published>2011-04-08T17:03:00.001-07:00</published><updated>2011-04-08T17:12:40.859-07:00</updated><title type='text'>Natural gas consumption</title><content type='html'>&lt;script type="text/javascript" id="WolframAlphaScript22cc70b02596865f1ec15c5b156574fb" src="http://www.wolframalpha.com/widget/widget.jsp?id=22cc70b02596865f1ec15c5b156574fb"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;..............&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8305488288160721786?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8305488288160721786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/04/natural-gas-consumption.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8305488288160721786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8305488288160721786'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/04/natural-gas-consumption.html' title='Natural gas consumption'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6023550665285559924</id><published>2011-04-07T15:22:00.000-07:00</published><updated>2011-04-08T17:08:45.099-07:00</updated><title type='text'>Energy consumption by country</title><content type='html'>This is my first widget from Wolfram Alpha&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript" id="WolframAlphaScript2ea3ff45d620f62b6669490c57394f3c" src="http://www.wolframalpha.com/widget/widget.jsp?id=2ea3ff45d620f62b6669490c57394f3c"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Wow!! so nice and simple to make&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6023550665285559924?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6023550665285559924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/04/energy-consumption-by-country.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6023550665285559924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6023550665285559924'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/04/energy-consumption-by-country.html' title='Energy consumption by country'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4383163193292299107</id><published>2011-03-29T14:24:00.000-07:00</published><updated>2011-03-29T14:24:47.616-07:00</updated><title type='text'>Finances and the rise of machines</title><content type='html'>Last Friday March 25th I attended the &lt;a href="http://orfe.princeton.edu/QuantTrading/"&gt;Princeton University Conference on Quant Trading&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;One of the most interesting talks was the analysis of the role of computers in trading &lt;br /&gt;&lt;a href="http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1501135"&gt; Rise of the Machines: Algorithmic Trading in the Foreign Exchange Market &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The conclusion is that computers are becoming more and more prevalent and actually dominate the Forex market already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4383163193292299107?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4383163193292299107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/03/finances-and-rise-of-machines.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4383163193292299107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4383163193292299107'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/03/finances-and-rise-of-machines.html' title='Finances and the rise of machines'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2574284284420736963</id><published>2011-03-25T16:04:00.000-07:00</published><updated>2011-03-28T19:14:09.300-07:00</updated><title type='text'>Inverse Matrix by the Exchange Method</title><content type='html'>After some time off, here I am again.&lt;br /&gt;&lt;br /&gt;Here is an interesting implementation of the inverse of a matrix that I found useful when I was developing a CUDA program. This is the most efficient method to implement the inverse of a matrix in terms of memory usage, which is handy when we want to put everything in the fast but limited shared memory.&lt;br /&gt;&lt;br /&gt;The Mathematica code is here&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B6kZZ7ml-th8MjI1N2I0YzYtN2EwNi00ODI2LTliYTEtZDJmMTQ2NzkwZTA4&amp;amp;hl=en"&gt; InverseExchange.cdf &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The cuda code is next&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B6kZZ7ml-th8MjI5NjBiNDctNDNjNy00MGFhLWI1ZTEtMmVkMGZmYTJjZGQ2&amp;amp;hl=en"&gt; InverseExchange.cu &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2574284284420736963?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2574284284420736963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/03/inverse-matrix-by-exchange-method.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2574284284420736963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2574284284420736963'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/03/inverse-matrix-by-exchange-method.html' title='Inverse Matrix by the Exchange Method'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2195415212884850747</id><published>2011-01-30T23:24:00.000-08:00</published><updated>2011-01-30T23:24:50.459-08:00</updated><title type='text'>J. Math. Phys Most Downloaded Articles in August 2010</title><content type='html'>&lt;span style="font-size: small;"&gt;My paper about the connection between the Householder decomposition of unitary matrices and the canonical coset representation of unitary groups&lt;/span&gt; was the second most downloaded paper in August 2010&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jmp.aip.org/features/most_downloaded?month=8&amp;amp;year=2010"&gt;http://jmp.aip.org/features/most_downloaded?month=8&amp;amp;year=2010&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2195415212884850747?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2195415212884850747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2011/01/j-math-phys-most-downloaded-articles-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2195415212884850747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2195415212884850747'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2011/01/j-math-phys-most-downloaded-articles-in.html' title='J. Math. Phys Most Downloaded Articles in August 2010'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3292244734914619538</id><published>2010-12-06T14:36:00.000-08:00</published><updated>2010-12-06T14:36:19.499-08:00</updated><title type='text'>Ito Calculus with Tensorial</title><content type='html'>Here is a short example on how to use the &lt;i&gt;Tensorial&lt;/i&gt; package for Ito calculus (stochastic calculus)&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B6kZZ7ml-th8M2EyNmI3ZjgtOGI2Zi00YjI1LTlhYjMtZjNlNzM1MTViZGU3&amp;amp;hl=en&amp;amp;authkey=CPnG1IgI"&gt;ito.pdf&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3292244734914619538?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3292244734914619538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/12/ito-calculus-with-tensorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3292244734914619538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3292244734914619538'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/12/ito-calculus-with-tensorial.html' title='Ito Calculus with Tensorial'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1117996953469914012</id><published>2010-12-06T14:05:00.000-08:00</published><updated>2010-12-06T17:25:37.691-08:00</updated><title type='text'>Numerical Linear Algebra and Quantum Control</title><content type='html'>Here is a poster about some of my recently published research&lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B6kZZ7ml-th8MmU1OWJiMmEtMmMyZC00MjI2LWEzYWMtZjEyODdjNjY2ZmJh&amp;amp;hl=en&amp;amp;authkey=CPCijjk"&gt;Poster pdf &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1117996953469914012?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1117996953469914012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/12/numerical-linear-algebra-and-quantum.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1117996953469914012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1117996953469914012'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/12/numerical-linear-algebra-and-quantum.html' title='Numerical Linear Algebra and Quantum Control'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2579561004684975951</id><published>2010-12-05T21:22:00.000-08:00</published><updated>2010-12-05T21:22:43.556-08:00</updated><title type='text'>MathLink example 4: Trace of a complex matrix</title><content type='html'>In this example, I introduce the ability to treat complex numbers.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------&lt;br /&gt;myTrace.c&lt;br /&gt;-------------------------------------------------------&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;&lt;br /&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;string.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include "mathlink.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;extern&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt; myTrace&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;void&lt;/span&gt; myTrace&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; )&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  &lt;br /&gt; double&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;matrix&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;dims&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt;&lt;span class="operator"&gt; **&lt;/span&gt;heads&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt; rank&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt; &lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLGetReal64Array&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;matrix&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;dims&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;heads&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;rank&lt;span class="operator"&gt;) ){&lt;/span&gt;&lt;span class="comment"&gt; &lt;br /&gt; // unable to read data&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;  printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;" MLGetReal64Array error reading data \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt; };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; n&lt;span class="operator"&gt; =&lt;/span&gt; dims&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; resum&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; double&lt;/span&gt; imsum&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; sum&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; outdims&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;1&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;&lt;span class="operator"&gt; **&lt;/span&gt;outheads&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt; outrank&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; resum&lt;span class="operator"&gt; =&lt;/span&gt; resum&lt;span class="operator"&gt; +&lt;/span&gt; matrix&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; imsum&lt;span class="operator"&gt; =&lt;/span&gt; imsum&lt;span class="operator"&gt; +&lt;/span&gt; matrix&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;i&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;];&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; MLReleaseReal64Array&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;matrix&lt;span class="operator"&gt;,&lt;/span&gt;dims&lt;span class="operator"&gt;,&lt;/span&gt;heads&lt;span class="operator"&gt;,&lt;/span&gt;rank&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; MLPutFunction&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="string"&gt;"Complex"&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLPutFloat&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;resum&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt; MLPutFloat&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;imsum&lt;span class="operator"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#if WINDOWS_MATHLINK&lt;br /&gt;&lt;br /&gt;#if __BORLANDC__&lt;br /&gt;#pragma argsused&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; PASCAL WinMain&lt;span class="operator"&gt;(&lt;/span&gt; HINSTANCE hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; HINSTANCE hinstPrevious&lt;span class="operator"&gt;,&lt;/span&gt; LPSTR lpszCmdLine&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;  buff&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;512&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; buff_start&lt;span class="operator"&gt; =&lt;/span&gt; buff&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv_end&lt;span class="operator"&gt; =&lt;/span&gt; argv&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 32&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; hinstPrevious&lt;span class="operator"&gt; =&lt;/span&gt; hinstPrevious&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt; /* suppress warning */&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLInitializeIcon&lt;span class="operator"&gt;(&lt;/span&gt; hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;))&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLScanString&lt;span class="operator"&gt;(&lt;/span&gt; argv&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;argv_end&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;lpszCmdLine&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;buff_start&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;)(&lt;/span&gt;argv_end&lt;span class="operator"&gt; -&lt;/span&gt; argv&lt;span class="operator"&gt;),&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt; argv&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;(&lt;/span&gt;argc&lt;span class="operator"&gt;,&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;-----------------------------------------------------&lt;br /&gt;myTrace.tm&lt;br /&gt;-----------------------------------------------------&lt;br /&gt;&lt;pre&gt;&lt;span class="operator"&gt;:&lt;/span&gt;Begin&lt;span class="operator"&gt;:&lt;br /&gt;:&lt;/span&gt;Function&lt;span class="operator"&gt;:&lt;/span&gt;       myTrace&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Pattern&lt;span class="operator"&gt;:&lt;/span&gt;        myTrace&lt;span class="operator"&gt;[&lt;/span&gt; L_List&lt;span class="operator"&gt;]&lt;br /&gt;:&lt;/span&gt;Arguments&lt;span class="operator"&gt;:      {&lt;/span&gt; L&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ArgumentTypes&lt;span class="operator"&gt;:  {&lt;/span&gt; Manual&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ReturnType&lt;span class="operator"&gt;:&lt;/span&gt;     Manual&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;End&lt;span class="operator"&gt;:&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Evaluate&lt;span class="operator"&gt;:&lt;/span&gt; myTrace&lt;span class="operator"&gt;::&lt;/span&gt;usage&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="string"&gt; "myTrace[M] gives the trace of complex matrix M"&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;------------------------------------------------------&lt;br /&gt;Makefile&lt;br /&gt;------------------------------------------------------&lt;br /&gt;&lt;pre&gt;MPREP&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;mprep&lt;br /&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;myTrace&lt;span class="operator"&gt; :&lt;/span&gt; myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c myTrace&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;}&lt;/span&gt; myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c myTrace&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; -&lt;/span&gt;o myTrace&lt;span class="operator"&gt; -&lt;/span&gt;lML64i3&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lpthread&lt;span class="operator"&gt; -&lt;/span&gt;lrt&lt;span class="operator"&gt; -&lt;/span&gt;lstdc&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; :&lt;/span&gt; myTrace&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;MPREP&lt;span class="operator"&gt;}&lt;/span&gt; myTrace&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;span class="operator"&gt; -&lt;/span&gt;o $@&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------&lt;br /&gt;myTrace.nb&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;link = Install["./myTrace"]&lt;br /&gt;&lt;br /&gt;(m = {{1., 2., 1.}, {2., 2., 2.}, {3., 3., 3.}} + I) // MatrixForm&lt;br /&gt;&lt;br /&gt;myTrace[m]&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2579561004684975951?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2579561004684975951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/12/mathlink-example-4-trace-of-complex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2579561004684975951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2579561004684975951'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/12/mathlink-example-4-trace-of-complex.html' title='MathLink example 4: Trace of a complex matrix'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7497210829296806000</id><published>2010-12-04T22:45:00.000-08:00</published><updated>2010-12-05T21:08:54.642-08:00</updated><title type='text'>MathLink example 3: Trace of a real matrix</title><content type='html'>In this example we calculate the trace of a matrix of floating point numbers (double type in C)&lt;br /&gt;&lt;br /&gt;---------------------------------------------------&lt;br /&gt;myTrace.c&lt;br /&gt;---------------------------------------------------&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;&lt;br /&gt;#include "mathlink.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;extern&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; myTrace&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; myTrace&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; )&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  &lt;br /&gt; double&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;matrix&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;dims&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt;&lt;span class="operator"&gt; **&lt;/span&gt;heads&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; rank&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt; &lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLGetReal64Array&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;matrix&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;dims&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;heads&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;rank&lt;span class="operator"&gt;) ){&lt;/span&gt;&lt;span class="comment"&gt; &lt;br /&gt; // unable to read data&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="flow"&gt;  return&lt;/span&gt;&lt;span class="float"&gt; 0.&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt; };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; n&lt;span class="operator"&gt; =&lt;/span&gt; dims&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; sum&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; sum&lt;span class="operator"&gt; =&lt;/span&gt; sum&lt;span class="operator"&gt; +&lt;/span&gt; matrix&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;+&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; MLReleaseReal64Array&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;matrix&lt;span class="operator"&gt;,&lt;/span&gt;dims&lt;span class="operator"&gt;,&lt;/span&gt;heads&lt;span class="operator"&gt;,&lt;/span&gt;rank&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; sum&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#if WINDOWS_MATHLINK&lt;br /&gt;&lt;br /&gt;#if __BORLANDC__&lt;br /&gt;#pragma argsused&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; PASCAL WinMain&lt;span class="operator"&gt;(&lt;/span&gt; HINSTANCE hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; HINSTANCE hinstPrevious&lt;span class="operator"&gt;,&lt;/span&gt; LPSTR lpszCmdLine&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;  buff&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;512&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; buff_start&lt;span class="operator"&gt; =&lt;/span&gt; buff&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv_end&lt;span class="operator"&gt; =&lt;/span&gt; argv&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 32&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; hinstPrevious&lt;span class="operator"&gt; =&lt;/span&gt; hinstPrevious&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt; /* suppress warning */&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLInitializeIcon&lt;span class="operator"&gt;(&lt;/span&gt; hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;))&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLScanString&lt;span class="operator"&gt;(&lt;/span&gt; argv&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;argv_end&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;lpszCmdLine&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;buff_start&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;)(&lt;/span&gt;argv_end&lt;span class="operator"&gt; -&lt;/span&gt; argv&lt;span class="operator"&gt;),&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt; argv&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;(&lt;/span&gt;argc&lt;span class="operator"&gt;,&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;----------------------------------------------&lt;br /&gt;myTrace.tm&lt;br /&gt;----------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="operator"&gt;:&lt;/span&gt;Begin&lt;span class="operator"&gt;:&lt;br /&gt;:&lt;/span&gt;Function&lt;span class="operator"&gt;:&lt;/span&gt;       myTrace&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Pattern&lt;span class="operator"&gt;:&lt;/span&gt;        myTrace&lt;span class="operator"&gt;[&lt;/span&gt; L_List&lt;span class="operator"&gt;]&lt;br /&gt;:&lt;/span&gt;Arguments&lt;span class="operator"&gt;:      {&lt;/span&gt; L&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ArgumentTypes&lt;span class="operator"&gt;:  {&lt;/span&gt; Manual&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ReturnType&lt;span class="operator"&gt;:&lt;/span&gt;     Real&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;End&lt;span class="operator"&gt;:&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Evaluate&lt;span class="operator"&gt;:&lt;/span&gt; myTrace&lt;span class="operator"&gt;::&lt;/span&gt;usage&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="string"&gt; "myTrace[M] gives the trace of matrix M"&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;---------------------------------------------&lt;br /&gt;Makefile&lt;br /&gt;---------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;MPREP&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;mprep&lt;br /&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;myTrace&lt;span class="operator"&gt; :&lt;/span&gt; myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c myTrace&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;}&lt;/span&gt; myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c myTrace&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; -&lt;/span&gt;o myTrace&lt;span class="operator"&gt; -&lt;/span&gt;lML64i3&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lpthread&lt;span class="operator"&gt; -&lt;/span&gt;lrt&lt;span class="operator"&gt; -&lt;/span&gt;lstdc&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;myTracetm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; :&lt;/span&gt; myTrace&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;MPREP&lt;span class="operator"&gt;}&lt;/span&gt; myTrace&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;span class="operator"&gt; -&lt;/span&gt;o $@&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7497210829296806000?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7497210829296806000/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/12/mathlink-example-3-trace-of-matrix.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7497210829296806000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7497210829296806000'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/12/mathlink-example-3-trace-of-matrix.html' title='MathLink example 3: Trace of a real matrix'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4641759598529246693</id><published>2010-11-24T23:28:00.000-08:00</published><updated>2010-12-03T15:01:37.393-08:00</updated><title type='text'>Catenary</title><content type='html'>The catenary is the curve that is naturally formed when a chain of constant linear density hangs from two fixed points. This is a typical example on variational calculus showing the use of Lagrange multipliers. Next, I develop the problem entirely in &lt;i&gt;Mathematica&lt;/i&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=0B6kZZ7ml-th8NTIzNzdlZGUtZDgxMC00Yzk3LWJjMjEtOGNmNmQyNWU5MmVm&amp;amp;hl=en"&gt;Catenary&lt;/a&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/viewer?a=v&amp;amp;pid=explorer&amp;amp;chrome=true&amp;amp;srcid=0B6kZZ7ml-th8OTZkYjEwNDYtNTA0Yi00YjJhLTg2ZjAtOThmMWQ1YTEzYWQ1&amp;amp;hl=en"&gt;Catenary(pdf)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You may need &lt;a href="http://www.wolfram.com/products/player/"&gt;MathematicaPlayer&lt;/a&gt; if you do not have &lt;i&gt;Mathematica&lt;/i&gt;.&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_n_RyvlYppL4/TO4Rg12io_I/AAAAAAAAAGo/jO8qPLWBX9w/s1600/Catenary.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="211" src="http://2.bp.blogspot.com/_n_RyvlYppL4/TO4Rg12io_I/AAAAAAAAAGo/jO8qPLWBX9w/s320/Catenary.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;This problem can be generalized to find the surface with minimum energy, which is shown next&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_n_RyvlYppL4/TPl2WNv66KI/AAAAAAAAAGs/Kgt6j4pUR18/s1600/surface.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="http://1.bp.blogspot.com/_n_RyvlYppL4/TPl2WNv66KI/AAAAAAAAAGs/Kgt6j4pUR18/s320/surface.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_n_RyvlYppL4/TO4QILAdOoI/AAAAAAAAAGk/s_JGfnPCDII/s1600/Catenary.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4641759598529246693?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4641759598529246693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/11/catenary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4641759598529246693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4641759598529246693'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/11/catenary.html' title='Catenary'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_n_RyvlYppL4/TO4Rg12io_I/AAAAAAAAAGo/jO8qPLWBX9w/s72-c/Catenary.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3634521123649012082</id><published>2010-11-24T21:23:00.000-08:00</published><updated>2010-11-24T21:28:23.221-08:00</updated><title type='text'>MathLink Example 2: Sum a list of floating point numbers</title><content type='html'>This example considers a sum of of floating point numbers. &lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;addRealList.c&lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include "mathlink.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;extern&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; addRealList&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; addRealList&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt;&lt;span class="operator"&gt; )&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;list&lt;span class="operator"&gt;;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt; MLGetReal64List&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;list&lt;span class="operator"&gt;,&amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; sum&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; sum&lt;span class="operator"&gt; =&lt;/span&gt; sum&lt;span class="operator"&gt; +&lt;/span&gt; list&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  MLReleaseReal64List&lt;span class="operator"&gt;(&lt;/span&gt;stdlink&lt;span class="operator"&gt;,&lt;/span&gt;list&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; sum&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#if WINDOWS_MATHLINK&lt;br /&gt;&lt;br /&gt;#if __BORLANDC__&lt;br /&gt;#pragma argsused&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; PASCAL WinMain&lt;span class="operator"&gt;(&lt;/span&gt; HINSTANCE hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; HINSTANCE hinstPrevious&lt;span class="operator"&gt;,&lt;/span&gt; LPSTR lpszCmdLine&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;  buff&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;512&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; buff_start&lt;span class="operator"&gt; =&lt;/span&gt; buff&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv_end&lt;span class="operator"&gt; =&lt;/span&gt; argv&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 32&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; hinstPrevious&lt;span class="operator"&gt; =&lt;/span&gt; hinstPrevious&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt; /* suppress warning */&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLInitializeIcon&lt;span class="operator"&gt;(&lt;/span&gt; hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;))&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLScanString&lt;span class="operator"&gt;(&lt;/span&gt; argv&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;argv_end&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;lpszCmdLine&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;buff_start&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;)(&lt;/span&gt;argv_end&lt;span class="operator"&gt; -&lt;/span&gt; argv&lt;span class="operator"&gt;),&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt; argv&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;(&lt;/span&gt;argc&lt;span class="operator"&gt;,&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;------------------------------------------------------&lt;br /&gt;addRealList.tm&lt;br /&gt;------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="operator"&gt;:&lt;/span&gt;Begin&lt;span class="operator"&gt;:&lt;br /&gt;:&lt;/span&gt;Function&lt;span class="operator"&gt;:&lt;/span&gt;       addRealList&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Pattern&lt;span class="operator"&gt;:&lt;/span&gt;        addRealList&lt;span class="operator"&gt;[&lt;/span&gt; L&lt;span class="operator"&gt;:{&lt;/span&gt;___Real&lt;span class="operator"&gt;}]&lt;br /&gt;:&lt;/span&gt;Arguments&lt;span class="operator"&gt;:      {&lt;/span&gt; L&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ArgumentTypes&lt;span class="operator"&gt;:  {&lt;/span&gt; Manual&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ReturnType&lt;span class="operator"&gt;:&lt;/span&gt;     Real&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;End&lt;span class="operator"&gt;:&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Evaluate&lt;span class="operator"&gt;:&lt;/span&gt; addRealList&lt;span class="operator"&gt;::&lt;/span&gt;usage&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="string"&gt; "addRealList[x] gives the sum of the elements on x, given that they are real (double floating numbers)"&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;------------------------------------------&lt;br /&gt;Makefile&lt;br /&gt;------------------------------------------&lt;br /&gt;&lt;pre&gt;MPREP&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;mprep&lt;br /&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;addRealList&lt;span class="operator"&gt; :&lt;/span&gt; addRealListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;}&lt;/span&gt; addRealListtm&lt;span class="operator"&gt;.&lt;/span&gt;c addRealList&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; -&lt;/span&gt;o addRealList&lt;span class="operator"&gt; -&lt;/span&gt;lML64i3&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lpthread&lt;span class="operator"&gt; -&lt;/span&gt;lrt&lt;span class="operator"&gt; -&lt;/span&gt;lstdc&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;addRealListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; :&lt;/span&gt; addRealList&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;MPREP&lt;span class="operator"&gt;}&lt;/span&gt; addRealList&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;span class="operator"&gt; -&lt;/span&gt;o $@&lt;br /&gt;&lt;br /&gt;clean&lt;span class="operator"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; rm addRealListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; rm addRealList&lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;addRealList.nb&lt;br /&gt;--------------------------------------------------------&lt;br /&gt;&lt;br /&gt;link = Install["./addRealList"]&lt;br /&gt;&lt;br /&gt;?addRealList&lt;br /&gt;&lt;br /&gt;addRealList[{1., 5., 6.}]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3634521123649012082?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3634521123649012082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-2-addreallist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3634521123649012082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3634521123649012082'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-2-addreallist.html' title='MathLink Example 2: Sum a list of floating point numbers'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2018873700301971675</id><published>2010-11-23T21:31:00.000-08:00</published><updated>2010-11-24T21:27:55.947-08:00</updated><title type='text'>MathLink Example 1: Sum a List of Integers</title><content type='html'>This example passes a list of integers, performs the sum and returns an integer.&lt;br /&gt;We must note that the length of the list is not type int but type long.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;addList.c&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include "mathlink.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;extern&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; addList&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;list&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; long&lt;/span&gt; n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; addList&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;list&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; long&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; double&lt;/span&gt; sum&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; sum&lt;span class="operator"&gt; =&lt;/span&gt; sum&lt;span class="operator"&gt; +&lt;/span&gt; list&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; return&lt;/span&gt; sum&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#if WINDOWS_MATHLINK&lt;br /&gt;&lt;br /&gt;#if __BORLANDC__&lt;br /&gt;#pragma argsused&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; PASCAL WinMain&lt;span class="operator"&gt;(&lt;/span&gt; HINSTANCE hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; HINSTANCE hinstPrevious&lt;span class="operator"&gt;,&lt;/span&gt; LPSTR lpszCmdLine&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;  buff&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;512&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; buff_start&lt;span class="operator"&gt; =&lt;/span&gt; buff&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv_end&lt;span class="operator"&gt; =&lt;/span&gt; argv&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 32&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; hinstPrevious&lt;span class="operator"&gt; =&lt;/span&gt; hinstPrevious&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt; /* suppress warning */&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLInitializeIcon&lt;span class="operator"&gt;(&lt;/span&gt; hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;))&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLScanString&lt;span class="operator"&gt;(&lt;/span&gt; argv&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;argv_end&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;lpszCmdLine&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;buff_start&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;)(&lt;/span&gt;argv_end&lt;span class="operator"&gt; -&lt;/span&gt; argv&lt;span class="operator"&gt;),&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt; argv&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;(&lt;/span&gt;argc&lt;span class="operator"&gt;,&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;&amp;nbsp;addList.tm&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;&lt;pre&gt;&lt;span class="operator"&gt;:&lt;/span&gt;Begin&lt;span class="operator"&gt;:&lt;br /&gt;:&lt;/span&gt;Function&lt;span class="operator"&gt;:&lt;/span&gt;       addList&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Pattern&lt;span class="operator"&gt;:&lt;/span&gt;        addList&lt;span class="operator"&gt;[&lt;/span&gt; L_List&lt;span class="operator"&gt;]&lt;br /&gt;:&lt;/span&gt;Arguments&lt;span class="operator"&gt;:      {&lt;/span&gt; L&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ArgumentTypes&lt;span class="operator"&gt;:  {&lt;/span&gt; RealList&lt;span class="operator"&gt;  }&lt;br /&gt;:&lt;/span&gt;ReturnType&lt;span class="operator"&gt;:&lt;/span&gt;     Real&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;End&lt;span class="operator"&gt;:&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Evaluate&lt;span class="operator"&gt;:&lt;/span&gt; addList&lt;span class="operator"&gt;::&lt;/span&gt;usage&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="string"&gt; "addList[x] gives the sum of the elements of the list x"&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;Makefile&lt;br /&gt;---------------------------------------------------------------------&lt;br /&gt;&lt;pre&gt;MPREP&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;mprep&lt;br /&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BINARIES&lt;span class="operator"&gt; =&lt;/span&gt; addList&lt;br /&gt;&lt;br /&gt;all&lt;span class="operator"&gt; :&lt;/span&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;BINARIES&lt;span class="operator"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;addList&lt;span class="operator"&gt; :&lt;/span&gt; addListtm&lt;span class="operator"&gt;.&lt;/span&gt;c addList&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;}&lt;/span&gt;  addList&lt;span class="operator"&gt;.&lt;/span&gt;c addListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt;  -&lt;/span&gt;lML64i3&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lpthread&lt;span class="operator"&gt; -&lt;/span&gt;lrt&lt;span class="operator"&gt; -&lt;/span&gt;lstdc&lt;span class="operator"&gt;++ -&lt;/span&gt;o $@&lt;br /&gt;&lt;br /&gt;addListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; :&lt;/span&gt; addList&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;MPREP&lt;span class="operator"&gt;}&lt;/span&gt; addList&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;span class="operator"&gt; -&lt;/span&gt;o addListtm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;/pre&gt;&lt;br /&gt;-------------------------------------------&lt;br /&gt;addList.nb&lt;br /&gt;-------------------------------------------&lt;br /&gt;&lt;br /&gt;link = Install["./addList"]&lt;br /&gt;&lt;br /&gt;addList[{1, 5, 6}]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2018873700301971675?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2018873700301971675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2018873700301971675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2018873700301971675'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-1.html' title='MathLink Example 1: Sum a List of Integers'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8166042343762160289</id><published>2010-11-22T23:00:00.000-08:00</published><updated>2010-11-24T21:29:02.819-08:00</updated><title type='text'>MathLink Example 0</title><content type='html'>&lt;a href="http://reference.wolfram.com/mathematica/tutorial/MathLinkAndExternalProgramCommunicationOverview.html"&gt;MathLink&lt;/a&gt; is a protocol on how to communicate &lt;i&gt;Mathematica&lt;/i&gt; with external programs. For example, one would like to run compiled code in C within the &lt;i&gt;Mathematica&lt;/i&gt; environment.&amp;nbsp; I am going to post a sequence of MathLink programs for Linux with an increasing level of complexity, starting from a simple example already found in the &lt;i&gt;Mathematica&lt;/i&gt; help (included for completeness) finishing with an example where I send and receive a matrix of complex numbers processed by the GPU using CUDA&lt;br /&gt;&lt;br /&gt;Most examples are made of 4 files:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;*.c&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : where the computation occurs.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; *.tm&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : MathLink template where the input and output are specified and the documentation of the function is placed.&amp;nbsp; &lt;/li&gt;&lt;li&gt;Makefile&amp;nbsp;&amp;nbsp; : where the compilation sequence is specified&lt;/li&gt;&lt;li&gt;*.nb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Mathematica notebook that executes the whole program&lt;/li&gt;&lt;/ul&gt;These files have to be placed in the same folder and compiled with: &lt;span style="background-color: black;"&gt;&lt;span style="color: white;"&gt;$make &lt;/span&gt;&lt;/span&gt;, which may need editing in order to provide the path of the executable file &lt;span style="background-color: black; color: white;"&gt;mprep&lt;/span&gt; that comes as part of &lt;i&gt;Mathematica.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;As seen in Makefile&lt;i&gt;, &lt;/i&gt;&lt;span style="background-color: black; color: white;"&gt;mprep&lt;/span&gt; generates a proper *.c code from the *.tm file, which is compiled along with the *.c file that contains the computational process. &lt;br /&gt;&lt;br /&gt;The first example adds two integers&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;addtwo.c&lt;br /&gt;--------------------------------------------------------------------------------- &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include "mathlink.h"&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;extern&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; addtwo&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; j&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; addtwo&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; j&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; i&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#if WINDOWS_MATHLINK&lt;br /&gt;&lt;br /&gt;#if __BORLANDC__&lt;br /&gt;#pragma argsused&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; PASCAL WinMain&lt;span class="operator"&gt;(&lt;/span&gt; HINSTANCE hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; HINSTANCE hinstPrevious&lt;span class="operator"&gt;,&lt;/span&gt; LPSTR lpszCmdLine&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt;  buff&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;512&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; buff_start&lt;span class="operator"&gt; =&lt;/span&gt; buff&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; char&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; FAR&lt;span class="operator"&gt; *&lt;/span&gt; argv_end&lt;span class="operator"&gt; =&lt;/span&gt; argv&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 32&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; hinstPrevious&lt;span class="operator"&gt; =&lt;/span&gt; hinstPrevious&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt; /* suppress warning */&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt;( !&lt;/span&gt;MLInitializeIcon&lt;span class="operator"&gt;(&lt;/span&gt; hinstCurrent&lt;span class="operator"&gt;,&lt;/span&gt; nCmdShow&lt;span class="operator"&gt;))&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MLScanString&lt;span class="operator"&gt;(&lt;/span&gt; argv&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;argv_end&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;lpszCmdLine&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;buff_start&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;)(&lt;/span&gt;argv_end&lt;span class="operator"&gt; -&lt;/span&gt; argv&lt;span class="operator"&gt;),&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#else&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt; argv&lt;span class="operator"&gt;[])&lt;br /&gt;{&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; return&lt;/span&gt; MLMain&lt;span class="operator"&gt;(&lt;/span&gt;argc&lt;span class="operator"&gt;,&lt;/span&gt; argv&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;&amp;nbsp;addtwo.tm&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="type"&gt;int&lt;/span&gt; addtwo P&lt;span class="operator"&gt;((&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;));&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Begin&lt;span class="operator"&gt;:&lt;br /&gt;:&lt;/span&gt;Function&lt;span class="operator"&gt;:&lt;/span&gt;       addtwo&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Pattern&lt;span class="operator"&gt;:&lt;/span&gt;        AddTwo&lt;span class="operator"&gt;[&lt;/span&gt;i_Integer&lt;span class="operator"&gt;,&lt;/span&gt; j_Integer&lt;span class="operator"&gt;]&lt;br /&gt;:&lt;/span&gt;Arguments&lt;span class="operator"&gt;:      {&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt; j&lt;span class="operator"&gt; }&lt;br /&gt;:&lt;/span&gt;ArgumentTypes&lt;span class="operator"&gt;:  {&lt;/span&gt; Integer&lt;span class="operator"&gt;,&lt;/span&gt; Integer&lt;span class="operator"&gt; }&lt;br /&gt;:&lt;/span&gt;ReturnType&lt;span class="operator"&gt;:&lt;/span&gt;     Integer&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;End&lt;span class="operator"&gt;:&lt;br /&gt;&lt;br /&gt;:&lt;/span&gt;Evaluate&lt;span class="operator"&gt;:&lt;/span&gt; AddTwo&lt;span class="operator"&gt;::&lt;/span&gt;usage&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="string"&gt; "AddTwo[x, y] gives the sum of two machine integers x and y."&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;------------------------------------------------------------&lt;br /&gt;Makefile &lt;br /&gt;------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;MPREP&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;mprep&lt;br /&gt;CXX&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BINARIES&lt;span class="operator"&gt; =&lt;/span&gt; addtwo&lt;br /&gt;&lt;br /&gt;all&lt;span class="operator"&gt; :&lt;/span&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;BINARIES&lt;span class="operator"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;addtwo&lt;span class="operator"&gt; :&lt;/span&gt; addtwotm&lt;span class="operator"&gt;.&lt;/span&gt;c addtwo&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;CXX&lt;span class="operator"&gt;}&lt;/span&gt;  addtwotm&lt;span class="operator"&gt;.&lt;/span&gt;c addtwo&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt;  -&lt;/span&gt;lML64i3&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;span class="operator"&gt; -&lt;/span&gt;lpthread&lt;span class="operator"&gt; -&lt;/span&gt;lrt&lt;span class="operator"&gt; -&lt;/span&gt;lstdc&lt;span class="operator"&gt;++ -&lt;/span&gt;o $@&lt;br /&gt;&lt;br /&gt;addtwotm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt; :&lt;/span&gt; addtwo&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;br /&gt; $&lt;span class="operator"&gt;{&lt;/span&gt;MPREP&lt;span class="operator"&gt;}&lt;/span&gt; addtwo&lt;span class="operator"&gt;.&lt;/span&gt;tm&lt;span class="operator"&gt; -&lt;/span&gt;o addtwotm&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;/pre&gt;&lt;br /&gt;------------------------------------------------&lt;br /&gt;addtwo.nb&lt;br /&gt;------------------------------------------------&lt;br /&gt;&lt;pre&gt;SetDirectory["/home/rcabrera/Documents/source/mathematica/MathLinkExamples/mytest2/alternative"]&lt;br /&gt;&lt;br /&gt;link = Install["./addtwo"]&lt;br /&gt;&lt;br /&gt;?AddTwo&lt;br /&gt;&lt;br /&gt;AddTwo[2, 3]&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8166042343762160289?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8166042343762160289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-0.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8166042343762160289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8166042343762160289'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/11/mathlink-0.html' title='MathLink Example 0'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6683828086954517994</id><published>2010-10-14T14:03:00.000-07:00</published><updated>2010-10-14T14:03:15.042-07:00</updated><title type='text'>Subversion</title><content type='html'>Subversion is a version control software very useful for software developers&lt;br /&gt;Here I found a nice video tutorial&lt;br /&gt;&lt;a href="http://showmedo.com/videotutorials/video?name=950000&amp;amp;fromSeriesID=95"&gt;http://showmedo.com/videotutorials/video?name=950000&amp;amp;fromSeriesID=95&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6683828086954517994?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6683828086954517994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/10/subversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6683828086954517994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6683828086954517994'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/10/subversion.html' title='Subversion'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3906529482738598337</id><published>2010-10-13T16:37:00.000-07:00</published><updated>2010-10-13T16:37:57.238-07:00</updated><title type='text'>Efimov states</title><content type='html'>I've heard about Efimov states some time ago and now I decided to put them in my shopping list &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sciencedaily.com/releases/2009/12/091211131526.htm"&gt;http://www.sciencedaily.com/releases/2009/12/091211131526.htm&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3906529482738598337?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3906529482738598337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/10/efimov-states.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3906529482738598337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3906529482738598337'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/10/efimov-states.html' title='Efimov states'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2700632336275402474</id><published>2010-10-03T02:28:00.000-07:00</published><updated>2010-10-11T22:47:25.923-07:00</updated><title type='text'>The Challenge to make quantum computers</title><content type='html'>The challenge to implement a completely scalable&amp;nbsp; quantum computer is tied with the understanding of the quantum/classical transition where quantum mechanics dominates the explanation of the microscopic world (up to the molecular scale more or less), but classical mechanics explains very well the ordinary macroscopic world. A completely scalable quantum computer would eventually give us a macroscopic taste of the imaginable strange quantum effects that so far have been seen only in the microscopic world.&lt;br /&gt;&lt;br /&gt;"Because there are no known fundamental obstacles to such scalability (practical quantum computer with large number of qubits), it has been suggested that failure to achieve it would reveal new physics" -&lt;a href="http://www.nist.gov/customcf/get_pdf.cfm?pub_id=902941"&gt;Emanuel Knill&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I feel that the most recent papers are becoming more conservative about their predictions on the feasibility of quantum computing despite fact that there is work stating that fault tolerant quantum computation is possible with two ingredients:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Maximum Error/Gate about 10^-4 to 10^-5&lt;/li&gt;&lt;li&gt;Effective error correction codes with ancillary qubits.&lt;/li&gt;&lt;/ul&gt;The last ingredient seems to be more or less accomplished&amp;nbsp; and the former one does not seem to be fundamentally unattainable despite the fact that we are currently very far. A paper that summarizes these facts with a high degree of scepticism is&lt;br /&gt;&lt;br /&gt;&lt;a href="http://arxiv.org/abs/quant-ph/0610117"&gt;Is Fault-Tolerant Quantum Computation Really Possible?&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;which I also like for its entertaining and straightforward writing style.&amp;nbsp;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2700632336275402474?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2700632336275402474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/10/challenge-to-make-quantum-computer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2700632336275402474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2700632336275402474'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/10/challenge-to-make-quantum-computer.html' title='The Challenge to make quantum computers'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2979845044776269834</id><published>2010-09-21T01:08:00.000-07:00</published><updated>2010-09-21T01:08:38.113-07:00</updated><title type='text'>Humble opinion about God and science</title><content type='html'>For some reason many physicists in the past and present such as Einstein and Hawking used the term God when they wanted to describe something essential and fundamental such as the laws of physics or the Big Bang theory. For most people this was an indication of their religiosity. However, anybody who knows the context of those words can tell that truth is different. &lt;a href="http://www.newscientist.com/article/dn19391-hawking-hasnt-changed-his-mind-about-god.html"&gt;Here is an article explaining this issue.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My personal point of view is that science does not require God by definition and not because science can prove that God does not exist. Defining science as the rational understanding of nature based on fundamental laws (and axioms), the acknowledgement of the existence of God would contradict this premise. Using God to explain something in science would be equivalent to admit an irrational element in the theory. In other words, admitting something that is not based on fundamental laws or axioms.&lt;br /&gt;&lt;br /&gt;However, I think there is still the &lt;i&gt;inconsistent&lt;/i&gt; possibility to put God outside science as the &lt;i&gt;something&lt;/i&gt; beyond the laws of physics and axioms. Some would place God as the creator of the laws of physics and axioms. I do not see any consistent and rational way to put God as the explanation of absolutely anything. Having said that, I do not consider myself as completely consistent and rational being and I do not think anybody was, is or will ever be, so, here it lies a window for the endless debate for the existence of God. &lt;br /&gt;&lt;br /&gt;Will we ever find a rational and consistent explanation for our consciousness and existence? Something tells me that the most likely answer is NOT.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2979845044776269834?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2979845044776269834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/09/humble-opinion-about-god-and-science.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2979845044776269834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2979845044776269834'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/09/humble-opinion-about-god-and-science.html' title='Humble opinion about God and science'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2893484468650027932</id><published>2010-08-25T05:43:00.000-07:00</published><updated>2010-08-25T05:44:41.713-07:00</updated><title type='text'>Inverse Tomography</title><content type='html'>A few years ago I had the pleasure to attend Pedro Goldman's presentation (Argentinian scientist) about his research in inverse tomography and applications to the calculation of the optimal dosage of radiation for radiotherapy. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://streamer.perimeterinstitute.ca/Flash/da5597ba-951c-48af-b505-29e9a59eb321/index.html"&gt;Fast Optimization or the Radiation Therapy of Tumors -the Impossible Possible&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sitting down on my chair I would not expect that this was going to be one of the most shocking and interesting presentations I ever attended.&lt;br /&gt;&lt;br /&gt;This research field is mathematically interesting and extremely important for medical physics.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2893484468650027932?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2893484468650027932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/08/inverse-tomography.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2893484468650027932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2893484468650027932'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/08/inverse-tomography.html' title='Inverse Tomography'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6717772571404116854</id><published>2010-08-20T12:22:00.000-07:00</published><updated>2010-08-20T12:32:26.691-07:00</updated><title type='text'>Computational Law</title><content type='html'>I did not know about this this research field until my last trip to Beijing China where I met Set Chandler, who develops his programs in Mathematica&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.wolfram.com/products/mathematica/portraits/sethchandler/"&gt;http://www.wolfram.com/products/mathematica/portraits/sethchandler/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The general idea is to develop models as response of the implementation of the laws. The idea is to minimize the subjectivity in today's approach. &lt;br /&gt;&lt;br /&gt;A much more ambitious project is to analyse the self consistency of the laws and their level of complexity. The complexity does not only depend on the document's length but also in how intricate is the relation with itself and other laws.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6717772571404116854?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6717772571404116854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/08/computational-law.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6717772571404116854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6717772571404116854'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/08/computational-law.html' title='Computational Law'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7714012015549052031</id><published>2010-08-18T15:31:00.000-07:00</published><updated>2010-08-18T15:31:19.123-07:00</updated><title type='text'>Videos created in Mathematica</title><content type='html'>I just learned about a video channel for videos created in Mathematica.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/channels/mathematica"&gt;http://vimeo.com/channels/mathematica&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7714012015549052031?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7714012015549052031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/08/videos-created-in-mathematica.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7714012015549052031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7714012015549052031'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/08/videos-created-in-mathematica.html' title='Videos created in Mathematica'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1622110334972099982</id><published>2010-08-10T17:32:00.000-07:00</published><updated>2010-09-13T16:53:57.534-07:00</updated><title type='text'>Medical Imaging</title><content type='html'>Medical Imaging is today a very active multidisciplinary research field where differential geometry, high performance computing&amp;nbsp; and diverse mathematics meet together.&lt;br /&gt;&lt;br /&gt;In my trip to China I had the opportunity to see some of the latests developments at professor &lt;a href="http://w3.bmt.tue.nl/en/peoplebme/?no_cache=1&amp;amp;script=showemp.php&amp;amp;pid=1296"&gt;Bart M. ter Haar Romeny&lt;/a&gt;'s group at the &lt;a href="http://w3.bmt.tue.nl/en/research/divisions_bme/biomedical_imaging_modeling/biomedical_image_analysis"&gt;University of Eindhoven&lt;/a&gt; in Holland.&lt;br /&gt;&lt;br /&gt;Some of the lastest thesis in his group that can be donwloaded are&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;E.M. Franken, &lt;a href="http://w3.bmt.tue.nl/nl/mensen_bij_bmt/?no_cache=1&amp;amp;script=showabstract.php&amp;amp;outid=10449" target="_blank"&gt;&lt;i&gt;Enhancement of Crossing Elongated Structures in Images&lt;/i&gt;&lt;/a&gt;, PhD. Thesis, 2008, Technische Universiteit Eindhoven. Advisors: B.M. ter Haar Romenij, R. Duits&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;M.A.van Almsick, &lt;a href="http://w3.bmt.tue.nl/nl/mensen_bij_bmt/?no_cache=1&amp;amp;script=showabstract.php&amp;amp;outid=9119" target="_blank"&gt;&lt;i&gt;Context Models of Lines and Contours&lt;/i&gt;&lt;/a&gt;, PhD. Thesis, 2007, Technische Universiteit Eindhoven. Advisors: B.M. ter Haar Romeny, L.M.J. Florack&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;E. Balmashnova, &lt;a href="http://w3.bmt.tue.nl/nl/mensen_bij_bmt/?no_cache=1&amp;amp;script=showabstract.php&amp;amp;outid=8429" target="_blank"&gt;&lt;i&gt;Scale-Euclidean Invariant Object Retrieval&lt;/i&gt;&lt;/a&gt;, PhD. Thesis, 2007, Technische Universiteit Eindhoven.Advisors: B.M. ter Haar Romenij,co-advisor: L.M.J. Florack&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;F.M.W. Kanters, &lt;a href="http://w3.bmt.tue.nl/nl/mensen_bij_bmt/?no_cache=1&amp;amp;script=showabstract.php&amp;amp;outid=8097" target="_blank"&gt;&lt;i&gt;Towards Object Based Image Editing&lt;/i&gt;&lt;/a&gt;, PhD. Thesis, 2007, TU/e. Advisors: B.M. ter Haar Romenij, L.M.J. Florack&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;B. Platel, &lt;a href="http://w3.bmt.tue.nl/nl/mensen_bij_bmt/?no_cache=1&amp;amp;script=showabstract.php&amp;amp;outid=8198" target="_blank"&gt;&lt;i&gt;Exploring the Deep Structure of Images&lt;/i&gt;&lt;/a&gt;, PhD. Thesis, 2007, Technische Universiteit Eindhoven. Advisors: B.M. ter Haar Romenij, Co-advisor: L.M.J. Florack&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Additionally, professor Romeny has a book entitled&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Front-End-Vision-Multi-Scale-Image-Analysis/dp/1402015038/ref=ntt_at_ep_dpi_1"&gt;Front-End Vision and Multi-Scale Image Analysis: Multi-scale Computer Vision Theory and Applications, written in &lt;i&gt;Mathematica &lt;/i&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bmia.bmt.tue.nl/Education/Courses/FEV/book/index.html"&gt;Online version&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The complete package can be found at&lt;br /&gt;&lt;a href="http://extras.springer.com/2003/978-1-4020-1507-6"&gt;http://extras.springer.com/2003/978-1-4020-1507-6 &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you are not afraid of modestly advanced mathematics and want something really applied, try this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1622110334972099982?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1622110334972099982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/08/medical-imaging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1622110334972099982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1622110334972099982'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/08/medical-imaging.html' title='Medical Imaging'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6221922699810488405</id><published>2010-08-03T14:35:00.000-07:00</published><updated>2010-11-29T21:56:35.446-08:00</updated><title type='text'>The canonical coset decomposition of unitary matrices through Householder transformations</title><content type='html'>My paper describing the connection between the Householder decomposition of and the canonical coset parametrization of unitary operators was published today in the Journal of Mathematical Physics&lt;br /&gt;&lt;br /&gt;&lt;a href="http://jmp.aip.org/jmapaq/v51/i8/p082101_s1"&gt;J. Math. Phys. &lt;b&gt;51&lt;/b&gt;, 082101 (2010)&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://arxiv.org/abs/1008.2477"&gt;http://arxiv.org/abs/1008.2477&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;This parametrization is very useful for calculating the parameters that uniquely characterises a given unitary operator U(N). I show that instead of solving a complicated systems of non-linear equations one can perform very stable and efficient Householder transformations.&amp;nbsp; Right now I am working on some practical applications based on that result.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6221922699810488405?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6221922699810488405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/08/canonical-coset-decomposition-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6221922699810488405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6221922699810488405'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/08/canonical-coset-decomposition-of.html' title='The canonical coset decomposition of unitary matrices through Householder transformations'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8371746710492537974</id><published>2010-07-30T08:24:00.000-07:00</published><updated>2010-08-05T11:26:57.186-07:00</updated><title type='text'>Independent Component Analysis</title><content type='html'>I was already familiar with the &lt;b&gt;&lt;a href="http://en.wikipedia.org/wiki/Principal_component_analysis"&gt;Principal component analysis&lt;/a&gt;, &lt;/b&gt;which is a method for finding a linear combination of variables such that the possible correlation between them disappears i.e. elimination of the diagonal elements of the covariance matrix. Statistical independence implies the elimination of correlation but the opposite is not necessarily true because there is possible association between the variables on higher orders.&amp;nbsp; The &lt;a href="http://en.wikipedia.org/wiki/Independent_component_analysis"&gt;Independent Component Analysis&lt;/a&gt; seems to be the generalization needed to go beyond the simple correlation.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Bartlett, M.S. and Movellan, J.R. and Sejnowski, T.J., Face recognition by independent component analysis, IEEE Transactions on neural networks,13, pp 1450--1464, 2002 &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Hyvarinen, A. and Oja, E. Independent component analysis: a tutorial, Neural Networks, 13, pp 411--430 2000&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8371746710492537974?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8371746710492537974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/07/independent-component-analysis.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8371746710492537974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8371746710492537974'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/07/independent-component-analysis.html' title='Independent Component Analysis'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-9076377614348000207</id><published>2010-07-30T07:20:00.000-07:00</published><updated>2010-07-30T07:20:05.351-07:00</updated><title type='text'>10th International Mathematica Symposium</title><content type='html'>I just returned from the 10th International Mathematica Symposium held in Beijing China, where I gave a &lt;a href="http://www.toyhouse.cc/ocs/index.php/ims/ims2010/paper/view/21"&gt;talk&lt;/a&gt;. It was a great opportunity to see the work of other people around the world and the new features of Mathematica 8. &lt;br /&gt;&lt;br /&gt;Some of the topics included medical imaging, stochastic simulations, video editing, real-time control, automatic C code generation, CUDA and more.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-9076377614348000207?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/9076377614348000207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/07/10th-international-mathematica.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/9076377614348000207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/9076377614348000207'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/07/10th-international-mathematica.html' title='10th International Mathematica Symposium'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1154231261493339926</id><published>2010-07-07T16:31:00.000-07:00</published><updated>2010-07-07T16:31:27.361-07:00</updated><title type='text'>Quantum entanglement and classical chaos</title><content type='html'>I recently attended a talk about the connection between quantum entanglement and classical chaos &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nature.com/nature/journal/v461/n7265/full/nature08396.html"&gt;http://www.nature.com/nature/journal/v461/n7265/full/nature08396.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This tells me that the underlying reason of the sensitivity to initial conditions in classical mechanics may be the rise of entanglement in a sequence with the collapse of the wave function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1154231261493339926?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1154231261493339926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/07/quantum-entanglement-and-classical_07.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1154231261493339926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1154231261493339926'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/07/quantum-entanglement-and-classical_07.html' title='Quantum entanglement and classical chaos'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7246007880446321163</id><published>2010-07-05T17:05:00.000-07:00</published><updated>2010-07-05T17:17:50.480-07:00</updated><title type='text'>Venn diagrams in R</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_n_RyvlYppL4/TDJ1_-JJsZI/AAAAAAAAAF0/QK1iOHLkgGU/s1600/venn.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 294px; height: 320px;" src="http://1.bp.blogspot.com/_n_RyvlYppL4/TDJ1_-JJsZI/AAAAAAAAAF0/QK1iOHLkgGU/s320/venn.gif" alt="" id="BLOGGER_PHOTO_ID_5490580637591646610" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This is my first attempt to use R, the well known program for statistics.&lt;br /&gt;&lt;br /&gt;I am using the package &lt;a href="http://bioinf.wehi.edu.au/limma/"&gt;LIMMA &lt;/a&gt;and the instructions found &lt;a href="http://www.ats.ucla.edu/stat/r/faq/venn.htm"&gt;here&lt;/a&gt; in order to draw Venn diagrams. My code is&lt;br /&gt;&lt;br /&gt;-----------------------------------------&lt;br /&gt;library(limma)&lt;br /&gt;&lt;br /&gt;data1&lt;-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h1.csv", sep=',', header=T)&lt;br /&gt;data2&lt;-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h2.csv", sep=',', header=T)&lt;br /&gt;data3&lt;-read.csv("/home/rcabrera/Documents/source/mathematica/Xiongmao/VennDiagram/H1h3.csv", sep=',', header=T)&lt;br /&gt;&lt;br /&gt;set1&lt;-data1$x&lt;br /&gt;set2&lt;-data2$x&lt;br /&gt;set3&lt;-data3$x&lt;br /&gt;&lt;br /&gt;set123&lt;-union(set1,union(set2,set3))&lt;br /&gt;&lt;br /&gt;bool1 = logical(length(set123))&lt;br /&gt;bool2 = logical(length(set123))&lt;br /&gt;bool3 = logical(length(set123))&lt;br /&gt;&lt;br /&gt;for(i in 1:length(set123)) bool1[i]&lt;-is.element(set123[i],set1)&lt;br /&gt;for(i in 1:length(set123)) bool2[i]&lt;-is.element(set123[i],set2)&lt;br /&gt;for(i in 1:length(set123)) bool3[i]&lt;-is.element(set123[i],set3)&lt;br /&gt;&lt;br /&gt;c3&lt;-cbind(bool1, bool2, bool3)&lt;br /&gt;&lt;br /&gt;a &lt;- vennCounts(c3)&lt;br /&gt;&lt;br /&gt;vennDiagram(a)&lt;br /&gt;-----------------------------------------------&lt;br /&gt;&lt;br /&gt;Note.- The data is stored in a column with label "x"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7246007880446321163?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7246007880446321163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/07/venn-diagrams-in-r.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7246007880446321163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7246007880446321163'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/07/venn-diagrams-in-r.html' title='Venn diagrams in R'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_n_RyvlYppL4/TDJ1_-JJsZI/AAAAAAAAAF0/QK1iOHLkgGU/s72-c/venn.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8744395158708778403</id><published>2010-07-02T21:05:00.000-07:00</published><updated>2010-07-02T21:35:47.808-07:00</updated><title type='text'>Mersenne Twister in CUDA</title><content type='html'>The Mersenne Twister algorithm (what a cool name) for generating random numbers is implemented as an example in the SDK folder provided by NVIDIA. However, as it happens with all the examples, it depends on the CUTIL library, which is not part of the standard CUDA API. There is another problem, the compilation of each example is carried out by a general set of makefiles customized for compiling all the examples. These are big problems if we want to generate a stand alone version of the examples. This is desirable because in this way we could adapt the code for our own purposes and eventually link with extra code.&lt;br /&gt;&lt;br /&gt;In the rest of this post I will give the makefiles that accomplish the stand alone compilation independent of CUTIL for the Mersenne Twister example.&lt;br /&gt;&lt;br /&gt;You will have to follow the following steps :&lt;br /&gt;&lt;br /&gt;- Make a copy of the Mersenne Twister folder from the SDK (I renamed as MersenneTwisterCUDA),&lt;br /&gt;&lt;br /&gt;- Remove all the references for the CUTIL library&lt;br /&gt;&lt;br /&gt;- Add the following lines on  MersenneTwister.cu&lt;br /&gt;&lt;br /&gt;char raw_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.raw";&lt;br /&gt;char dat_path[] = "/YOUR_PATH/MersenneTwisterCUDA/data/MersenneTwister.dat";&lt;br /&gt;&lt;br /&gt;while removing the corresponding lines that originally define raw_path and dat_path.&lt;br /&gt;&lt;br /&gt;- Finally, paste the make files I will provide and run $make on the command line&lt;br /&gt;(Define YOUR_PATH according to the structure of your directories)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;file: common&lt;br /&gt;----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;CUDA_PATH = /usr/local/cuda&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C := gcc&lt;br /&gt;CC := c++&lt;br /&gt;NVCC    := $(CUDA_PATH)/bin/nvcc&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CUDA_INCLUDE_PATH = /usr/local/cuda/include&lt;br /&gt;CUDA_LIB_PATH := $(CUDA_PATH)/lib64&lt;br /&gt;CUDA_FLAGS = -lcuda -lcudart&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;===================================================&lt;br /&gt;&lt;br /&gt;file: Makefile:&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;include ./common.mk&lt;br /&gt;&lt;br /&gt;MersenneTwister.out: genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o&lt;br /&gt; $(NVCC)  -L$(CUDA_LIB_PATH) $(CUDA_FLAGS)  genmtrand.c.o MersenneTwister_gold.cpp.o MersenneTwister.cu.o -o MersenneTwister.out&lt;br /&gt;&lt;br /&gt;MersenneTwister.cu.o: MersenneTwister.cu dci.h MersenneTwister.h MersenneTwister_kernel.cu&lt;br /&gt; $(NVCC) -c -I$(CUDA_INCLUDE_PATH)  MersenneTwister.cu -o MersenneTwister.cu.o&lt;br /&gt;&lt;br /&gt;MersenneTwister_gold.cpp.o: MersenneTwister_gold.cpp&lt;br /&gt; $(CC) -c MersenneTwister_gold.cpp -o MersenneTwister_gold.cpp.o&lt;br /&gt;&lt;br /&gt;genmtrand.c.o: genmtrand.c&lt;br /&gt; $(C) -c genmtrand.c -o genmtrand.c.o&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8744395158708778403?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8744395158708778403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/07/mersenne-twister-in-cuda.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8744395158708778403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8744395158708778403'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/07/mersenne-twister-in-cuda.html' title='Mersenne Twister in CUDA'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7271238641199475071</id><published>2010-05-30T21:52:00.000-07:00</published><updated>2010-05-30T22:04:44.947-07:00</updated><title type='text'>Classical Origin of Fermion Spin</title><content type='html'>The spin was postulated by Pauli from experimental evidence, but it was only with the arrival of the Dirac equation that the spin appears naturally. This leaded to many people to consider the spin as fundamentally "quantum".  In the following paper we argue that the spin appears naturally from classical relativistic mechanics alone&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;W. E. Baylis, R Cabrera, J.D. Keselica,  &lt;a href="http://www.springerlink.com/content/d20h16078tw728rl/?p=8f91f5555c914e55840ba54d0d807571&amp;amp;pi=22"&gt;Quantum/Classical Interface: Classical Geometric Origin of Fermion Spin&lt;/a&gt;, Advances in Applied Clifford Algebras, 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7271238641199475071?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7271238641199475071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/05/classical-origin-of-fermion-spin.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7271238641199475071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7271238641199475071'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/05/classical-origin-of-fermion-spin.html' title='Classical Origin of Fermion Spin'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2181345275473684288</id><published>2010-05-12T22:23:00.000-07:00</published><updated>2010-05-12T22:31:32.422-07:00</updated><title type='text'>Maxwell's demon</title><content type='html'>Mark G Raizen recently gave a talk about techniques for trapping and cooling atoms. In this way, he actually implemented Maxwell's demon in practice!&lt;br /&gt;&lt;br /&gt;http://www.sciencemag.org/cgi/content/abstract/324/5933/1403&lt;br /&gt;&lt;br /&gt;Yes, this demon exists and does not violate the second law of thermodynamics because information is a thermodynamic variable with an essential role.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2181345275473684288?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2181345275473684288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/05/maxwells-demon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2181345275473684288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2181345275473684288'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/05/maxwells-demon.html' title='Maxwell&apos;s demon'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5316663597242869988</id><published>2010-05-05T13:58:00.000-07:00</published><updated>2011-01-16T09:37:52.018-08:00</updated><title type='text'>Attention span</title><content type='html'>The amount of information we can absorb not only depends on the time we actually engage our attention. It also depends on how we distribute this time in subintervals. It seems that we can only pay our highest degree of attention for a few seconds [&lt;a href="http://en.wikipedia.org/wiki/Attention_span"&gt;wikipedia article&lt;/a&gt;], so what do we do in the rest?&lt;br /&gt;&lt;br /&gt;Related to this topic is the strategy followed by Hollywood, who are interested in maintaining their movies as appealing as possible. In this next article there is an interesting analysis of the duration and distribution of the shoot lengths.&lt;br /&gt;&lt;br /&gt;James E. Cutting,&lt;span style="font-size: 100%;"&gt; Attention and the Evolution of Hollywood Film&lt;/span&gt;&lt;i&gt; Psychological Science, 2010 &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;One of the main conclusions is that the distribution of power in the frequency domain must obey  1/f , where f is the frequency. I am sure this is particularly important for teachers and students.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://http//www.newscientist.com/article/mg20527483.900-solved-the-mathematics-of-the-hollywood-blockbuster.html"&gt;More comments about this article can be found here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5316663597242869988?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5316663597242869988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/05/attention-span.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5316663597242869988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5316663597242869988'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/05/attention-span.html' title='Attention span'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-479273391649811815</id><published>2010-05-02T20:22:00.000-07:00</published><updated>2010-05-02T20:27:19.585-07:00</updated><title type='text'>Eigenvalues: C/Lapack</title><content type='html'>Here is another example on the use of Lapack. This time the objective is to calculate the eigenvectors and eigenvalues of a complex matrix&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;complex.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;//.......................................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;Transposed&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;M&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; Transposed&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;+&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;j&lt;span class="operator"&gt;] =&lt;/span&gt; M&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;];&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//......................................................................................................&lt;br /&gt;//  MatrixComplexEigensystem: computes the eigenvectors and eigenValues of input matrix A&lt;br /&gt;//  The eigenvectors are stored in columns&lt;br /&gt;//.....................................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; MatrixComplexEigensystem&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;eigenvectorsVR&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;eigenvaluesW&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  &lt;br /&gt;  double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;AT&lt;span class="operator"&gt; = (&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;*)&lt;/span&gt; malloc&lt;span class="operator"&gt;(&lt;/span&gt; N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt; AT&lt;span class="operator"&gt;,&lt;/span&gt; A&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  &lt;br /&gt;  char&lt;/span&gt; JOBVL&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="char"&gt;'N'&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;   // Compute Right eigenvectors&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;  char&lt;/span&gt; JOBVR&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="char"&gt;'V'&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;   // Do not compute Left eigenvectors&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  double&lt;/span&gt; complex VL&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;1&lt;/span&gt;&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;  int&lt;/span&gt; LDVL&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt; &lt;br /&gt;  int&lt;/span&gt; LDVR&lt;span class="operator"&gt; =&lt;/span&gt; N&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; LWORK&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 4&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt; &lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;WORK&lt;span class="operator"&gt; =  (&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;*)&lt;/span&gt;malloc&lt;span class="operator"&gt;(&lt;/span&gt; LWORK&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;));&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;RWORK&lt;span class="operator"&gt; = (&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;*)&lt;/span&gt;malloc&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt; 2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;));&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; int&lt;/span&gt; INFO&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; zgeev_&lt;span class="operator"&gt;( &amp;amp;&lt;/span&gt;JOBVL&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;JOBVR&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;N&lt;span class="operator"&gt;,&lt;/span&gt; AT&lt;span class="operator"&gt; ,  &amp;amp;&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; eigenvaluesW&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   VL&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;LDVL&lt;span class="operator"&gt;,&lt;/span&gt;&lt;br /&gt;   eigenvectorsVR&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;LDVR&lt;span class="operator"&gt;,&lt;/span&gt; &lt;br /&gt;   WORK&lt;span class="operator"&gt;, &lt;br /&gt;   &amp;amp;&lt;/span&gt;LWORK&lt;span class="operator"&gt;,&lt;/span&gt; RWORK&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;INFO&lt;span class="operator"&gt; );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt; AT&lt;span class="operator"&gt;,&lt;/span&gt; eigenvectorsVR&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; eigenvectorsVR&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;]=&lt;/span&gt;AT&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  free&lt;span class="operator"&gt;(&lt;/span&gt;WORK&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;  free&lt;span class="operator"&gt;(&lt;/span&gt;RWORK&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;  free&lt;span class="operator"&gt;(&lt;/span&gt;AT&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;()&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;  const&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 3&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  double&lt;/span&gt; complex A&lt;span class="operator"&gt;[] = {&lt;/span&gt;&lt;span class="float"&gt; 1.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 2.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="int"&gt;  3&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 4.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 5.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 6.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 7.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 8.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 9.&lt;/span&gt;&lt;span class="operator"&gt; +&lt;/span&gt; I&lt;span class="operator"&gt;};&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;  double&lt;/span&gt; complex eigenVectors&lt;span class="operator"&gt;[&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;  double&lt;/span&gt; complex eigenValues&lt;span class="operator"&gt;[&lt;/span&gt;N&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;  MatrixComplexEigensystem&lt;span class="operator"&gt;(&lt;/span&gt; eigenVectors&lt;span class="operator"&gt;,&lt;/span&gt; eigenValues&lt;span class="operator"&gt;,&lt;/span&gt; A&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;  printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\nEigenvectors\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;    for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;" (%f,%f) \t"&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; eigenVectors&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;  }&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;  printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\nEigenvalues \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n (%f, %f) \t"&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;  eigenValues&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;] );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n------------------------------------------------------------\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt; &lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-479273391649811815?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/479273391649811815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/05/eigenvalues-clapack.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/479273391649811815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/479273391649811815'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/05/eigenvalues-clapack.html' title='Eigenvalues: C/Lapack'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4603382564604923011</id><published>2010-05-02T01:58:00.000-07:00</published><updated>2010-05-02T02:04:41.871-07:00</updated><title type='text'>Complex matrix inverse: C++/Lapack</title><content type='html'>So, here is an example on how to call lapack from c++ &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include&amp;lt;iostream&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;complex&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;using namespace&lt;/span&gt; std&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;&lt;br /&gt;extern&lt;/span&gt;&lt;span class="string"&gt; "C"&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt; zgetrf_&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;*,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* ,&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;* ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;*,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* );&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;&lt;br /&gt;extern&lt;/span&gt;&lt;span class="string"&gt; "C"&lt;/span&gt;&lt;span class="type"&gt; void&lt;/span&gt; zgetri_&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;*,&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;* ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;*,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* ,&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;*,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;* );&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//........................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt; *&lt;/span&gt;Transposed&lt;span class="operator"&gt;,&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt; *&lt;/span&gt;M&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; Transposed&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;+&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;j&lt;span class="operator"&gt;] =&lt;/span&gt; M&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;];&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//.........................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; MatrixComplexInverse&lt;span class="operator"&gt;(&lt;/span&gt;complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt; *&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt; *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; LWORK&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;10&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;permutations&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt; *&lt;/span&gt;WORK&lt;span class="operator"&gt;, *&lt;/span&gt;tempA&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; tempA&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="keyword"&gt; new&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;[&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; permutations&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="keyword"&gt;  new&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt;&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt; WORK&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="keyword"&gt; new&lt;/span&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;[&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; INFO&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;tempA&lt;span class="operator"&gt;,&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; zgetrf_&lt;span class="operator"&gt;( &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; tempA&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; permutations&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;INFO&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;INFO&lt;span class="operator"&gt; !=&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;) {&lt;/span&gt;&lt;br /&gt;   cout&lt;span class="operator"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="string"&gt;"ComplexMatrixInverse: Error at zgetrf  \n"&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt; exit&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; zgetri_&lt;span class="operator"&gt;( &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; tempA&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; permutations&lt;span class="operator"&gt; ,&lt;/span&gt; WORK&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;LWORK&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;INFO&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt; if&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;INFO&lt;span class="operator"&gt; !=&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;) {&lt;/span&gt;&lt;br /&gt;   cout&lt;span class="operator"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="string"&gt;"ComplexMatrixInverse: Error at zgetri  \n"&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt; exit&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt;tempA&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;&lt;br /&gt; delete&lt;/span&gt;&lt;span class="operator"&gt; []&lt;/span&gt; WORK&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;&lt;br /&gt; delete&lt;/span&gt;&lt;span class="operator"&gt; []&lt;/span&gt; tempA&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt; delete&lt;/span&gt;&lt;span class="operator"&gt; []&lt;/span&gt; permutations&lt;span class="operator"&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;()&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt; const&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 3&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;&lt;/span&gt; I&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt;1.&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;&lt;/span&gt; A&lt;span class="operator"&gt;[] = {&lt;/span&gt;&lt;span class="float"&gt; 1.&lt;/span&gt;&lt;span class="operator"&gt; +&lt;/span&gt; I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 2.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="int"&gt;  3&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 4.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 5.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 6.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 7.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 8.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 9.&lt;/span&gt;&lt;span class="operator"&gt; +&lt;/span&gt; I&lt;span class="operator"&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; complex&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;&lt;/span&gt; invA&lt;span class="operator"&gt;[&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; MatrixComplexInverse&lt;span class="operator"&gt;(&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;   for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; cout&lt;span class="operator"&gt; &amp;lt;&amp;lt;&lt;/span&gt; invA&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;]&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="string"&gt;"\t"&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   cout&lt;span class="operator"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="string"&gt;"\n"&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cout&lt;span class="operator"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="string"&gt;"---------------------------\n"&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;////////////////////=====================////////////////////&lt;br /&gt;&lt;br /&gt;and the make file is&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#&lt;br /&gt;&lt;/span&gt;CC&lt;span class="operator"&gt; =&lt;/span&gt; c&lt;span class="operator"&gt;++&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#edit LAPACK_PATH if necessary&lt;br /&gt;&lt;/span&gt;LAPACK_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;lib64&lt;span class="operator"&gt;/&lt;/span&gt;atlas&lt;br /&gt;&lt;br /&gt;a&lt;span class="operator"&gt;,&lt;/span&gt;out&lt;span class="operator"&gt;:&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;cpp&lt;br /&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;CC&lt;span class="operator"&gt;)&lt;/span&gt;&lt;span class="keyword"&gt;  main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;cpp&lt;span class="operator"&gt;  -&lt;/span&gt;L$&lt;span class="operator"&gt;(&lt;/span&gt;LAPACK_PATH&lt;span class="operator"&gt;) -&lt;/span&gt;llapack&lt;span class="operator"&gt; -&lt;/span&gt;lblas&lt;span class="operator"&gt;  -&lt;/span&gt;lgfortran&lt;span class="operator"&gt; -&lt;/span&gt;lm &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4603382564604923011?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4603382564604923011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/05/complex-matrix-inverse-clapack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4603382564604923011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4603382564604923011'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/05/complex-matrix-inverse-clapack.html' title='Complex matrix inverse: C++/Lapack'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3485265374318101383</id><published>2010-04-28T00:51:00.001-07:00</published><updated>2010-05-02T01:58:20.466-07:00</updated><title type='text'>My basic rules of programming</title><content type='html'>Here I am listing some general rules of programming that I learned to follow.&lt;br /&gt;Some of them are enforced by  certain languages or programming environments but some are very permissive and require to be more careful. These rules are already well known but here they are again&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Define very well the input from the output arguments of a function. The input arguments should remain unmodified in the routine.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Never write a routine that cannot fit in one page of computer screen in the worst case.&lt;/li&gt;&lt;li&gt;Develop and validate a program in reasonable small steps. It may take longer to write the code but it will take less time to debug.&lt;/li&gt;&lt;li&gt;Use a maximum of two nested loops in a certain routine.&lt;/li&gt;&lt;li&gt;Use meaningful names for the variables even if they become long.&lt;/li&gt;&lt;li&gt;Do not repeat the same task in different places.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3485265374318101383?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3485265374318101383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/04/my-basic-rules-of-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3485265374318101383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3485265374318101383'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/04/my-basic-rules-of-programming.html' title='My basic rules of programming'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-639760873253707969</id><published>2010-04-26T23:09:00.000-07:00</published><updated>2010-04-29T21:05:34.156-07:00</updated><title type='text'>Complex matrix inverse: C/Lapack</title><content type='html'>Here a simple example on how to use Lapack within C to invert matrices using the LU decomposition.&lt;br /&gt;&lt;br /&gt;The C++ code is different and I will post that another day&lt;br /&gt;&lt;br /&gt;[The html code for this post was generated by http://www.bedaux.net/cpp2html/]&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include&amp;lt;math.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;complex.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;//........................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;Transposed&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;M&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; Transposed&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;+&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;j&lt;span class="operator"&gt;] =&lt;/span&gt; M&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;];&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//.........................................................................................&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt; MatrixComplexInverse&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; LWORK&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;10&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="operator"&gt; *&lt;/span&gt;permutations&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt; *&lt;/span&gt;WORK&lt;span class="operator"&gt;, *&lt;/span&gt;tempA&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;tempA&lt;span class="operator"&gt; = (&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;*)&lt;/span&gt; malloc&lt;span class="operator"&gt;(&lt;/span&gt; n&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;permutations&lt;span class="operator"&gt; = (&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;*)&lt;/span&gt; malloc&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt; 2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="operator"&gt;) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;WORK&lt;span class="operator"&gt; = (&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt; *)&lt;/span&gt;malloc&lt;span class="operator"&gt;(&lt;/span&gt;LWORK&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;double&lt;/span&gt; complex&lt;span class="operator"&gt;));&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; INFO&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;tempA&lt;span class="operator"&gt;,&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;zgetrf_&lt;span class="operator"&gt;( &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; tempA&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; permutations&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;INFO&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;if&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;INFO&lt;span class="operator"&gt; !=&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;) {&lt;/span&gt;&lt;br /&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"ComplexMatrixInverse: Error at zgetrf  \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt; exit&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;zgetri_&lt;span class="operator"&gt;( &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; tempA&lt;span class="operator"&gt; , &amp;amp;&lt;/span&gt;n&lt;span class="operator"&gt;,&lt;/span&gt; permutations&lt;span class="operator"&gt; ,&lt;/span&gt; WORK&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;LWORK&lt;span class="operator"&gt;, &amp;amp;&lt;/span&gt;INFO&lt;span class="operator"&gt; );&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;if&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;INFO&lt;span class="operator"&gt; !=&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;) {&lt;/span&gt;&lt;br /&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"ComplexMatrixInverse: Error at zgetri  \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt; exit&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;zgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt;tempA&lt;span class="operator"&gt;,&lt;/span&gt;n&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;free&lt;span class="operator"&gt;(&lt;/span&gt;WORK&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;free&lt;span class="operator"&gt;(&lt;/span&gt;tempA&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;free&lt;span class="operator"&gt;(&lt;/span&gt;permutations&lt;span class="operator"&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;()&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="keyword"&gt;&lt;br /&gt;const&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 3&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; complex A&lt;span class="operator"&gt;[] = {&lt;/span&gt;&lt;span class="float"&gt; 1.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 2.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="int"&gt;  3&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 4.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 5.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 6.&lt;/span&gt;&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 7.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 8.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt; 9.&lt;/span&gt;&lt;span class="operator"&gt; +&lt;/span&gt; I&lt;span class="operator"&gt;};&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;double&lt;/span&gt; complex invA&lt;span class="operator"&gt;[&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;MatrixComplexInverse&lt;span class="operator"&gt;(&lt;/span&gt;invA&lt;span class="operator"&gt;,&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt; for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;" (%f,%f) \t"&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; invA&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"------------------------------------------------------------\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;return&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The make file is&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#&lt;br /&gt;&lt;/span&gt;CC&lt;span class="operator"&gt; =&lt;/span&gt; gcc&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#edit LAPACK_PATH if necessary&lt;br /&gt;&lt;/span&gt;LAPACK_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;lib64&lt;span class="operator"&gt;/&lt;/span&gt;atlas&lt;br /&gt;&lt;br /&gt;a&lt;span class="operator"&gt;,&lt;/span&gt;out&lt;span class="operator"&gt;:&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;br /&gt;$&lt;span class="operator"&gt;(&lt;/span&gt;CC&lt;span class="operator"&gt;)&lt;/span&gt;&lt;span class="keyword"&gt;  main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;c&lt;span class="operator"&gt;  -&lt;/span&gt;L$&lt;span class="operator"&gt;(&lt;/span&gt;LAPACK_PATH&lt;span class="operator"&gt;) -&lt;/span&gt;llapack&lt;span class="operator"&gt; -&lt;/span&gt;lblas&lt;span class="operator"&gt;  -&lt;/span&gt;lgfortran&lt;span class="operator"&gt; -&lt;/span&gt;lm&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-639760873253707969?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/639760873253707969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-c-with-plain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/639760873253707969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/639760873253707969'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-c-with-plain.html' title='Complex matrix inverse: C/Lapack'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1354055858592130241</id><published>2010-04-25T15:31:00.000-07:00</published><updated>2010-04-29T21:03:53.448-07:00</updated><title type='text'>Complex matrix inverse III: CUDA</title><content type='html'>Here is  cuinverse_kernel.cu&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;__global__&lt;span class="type"&gt; void&lt;/span&gt; cgeMatrixInverse_kernel&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;invA&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;Work&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; idx&lt;span class="operator"&gt; =&lt;/span&gt; blockDim&lt;span class="operator"&gt;.&lt;/span&gt;x&lt;span class="operator"&gt; *&lt;/span&gt; blockIdx&lt;span class="operator"&gt;.&lt;/span&gt;x&lt;span class="operator"&gt; +&lt;/span&gt; threadIdx&lt;span class="operator"&gt;.&lt;/span&gt;x&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt; ThreadWorkSpace&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ThreadWorkSpace&lt;span class="operator"&gt; =&lt;/span&gt; Work&lt;span class="operator"&gt; +&lt;/span&gt; idx&lt;span class="operator"&gt;*&lt;/span&gt;cgeMatrixInverse_WorkSpace&lt;span class="operator"&gt;()*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; A&lt;span class="operator"&gt;[&lt;/span&gt; i&lt;span class="operator"&gt; +&lt;/span&gt; idx&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ] =&lt;/span&gt;  A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A&lt;span class="operator"&gt;[&lt;/span&gt; idx&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ] =&lt;/span&gt; make_cuFloatComplex&lt;span class="operator"&gt;( (&lt;/span&gt;&lt;span class="type"&gt;float&lt;/span&gt;&lt;span class="operator"&gt;)&lt;/span&gt; idx&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt; 1.&lt;/span&gt;&lt;span class="operator"&gt;/&lt;/span&gt;sqrtf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cgeMatrixInverse&lt;span class="operator"&gt;(&lt;/span&gt;invA&lt;span class="operator"&gt; +&lt;/span&gt; idx&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; A&lt;span class="operator"&gt; +&lt;/span&gt; idx&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt; ,&lt;/span&gt; ThreadWorkSpace&lt;span class="operator"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;_______________________&lt;br /&gt;&lt;br /&gt;and my makefile is&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#  edit the path of your working directory&lt;br /&gt;&lt;/span&gt;BASE_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;home&lt;span class="operator"&gt;/&lt;/span&gt;rcabrera&lt;span class="operator"&gt;/&lt;/span&gt;Documents&lt;span class="operator"&gt;/&lt;/span&gt;source&lt;span class="operator"&gt;/&lt;/span&gt;c&lt;span class="operator"&gt;/&lt;/span&gt;inverseCUDA&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;CUDA_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;local&lt;span class="operator"&gt;/&lt;/span&gt;cuda&lt;br /&gt;&lt;br /&gt;CC&lt;span class="operator"&gt; =&lt;/span&gt; gcc&lt;br /&gt;NVCC&lt;span class="operator"&gt;    :=&lt;/span&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;CUDA_PATH&lt;span class="operator"&gt;)/&lt;/span&gt;bin&lt;span class="operator"&gt;/&lt;/span&gt;nvcc&lt;br /&gt;&lt;br /&gt;CUDA_INCLUDE_PATH&lt;span class="operator"&gt; = /&lt;/span&gt;usr&lt;span class="operator"&gt;/&lt;/span&gt;local&lt;span class="operator"&gt;/&lt;/span&gt;cuda&lt;span class="operator"&gt;/&lt;/span&gt;include&lt;br /&gt;CUDA_LIB_PATH&lt;span class="operator"&gt; :=&lt;/span&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;CUDA_PATH&lt;span class="operator"&gt;)/&lt;/span&gt;lib64&lt;br /&gt;CUDA_LIBS&lt;span class="operator"&gt; = -&lt;/span&gt;lcuda&lt;span class="operator"&gt; -&lt;/span&gt;lcudart&lt;br /&gt;&lt;br /&gt;a&lt;span class="operator"&gt;.&lt;/span&gt;out&lt;span class="operator"&gt;:&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;cu cuinverse_kernel&lt;span class="operator"&gt;.&lt;/span&gt;cu cumatrixtools&lt;span class="operator"&gt;.&lt;/span&gt;h&lt;br /&gt;$&lt;span class="operator"&gt;(&lt;/span&gt;NVCC&lt;span class="operator"&gt;)  -&lt;/span&gt;I$&lt;span class="operator"&gt;(&lt;/span&gt;CUDA_INCLUDE_PATH&lt;span class="operator"&gt;) -&lt;/span&gt;L$&lt;span class="operator"&gt;(&lt;/span&gt;CUDA_LIB_PATH&lt;span class="operator"&gt;)&lt;/span&gt; $&lt;span class="operator"&gt;(&lt;/span&gt;CUDA_LIBS&lt;span class="operator"&gt;) -&lt;/span&gt;lm&lt;span class="keyword"&gt;  main&lt;/span&gt;&lt;span class="operator"&gt;.&lt;/span&gt;cu&lt;span class="operator"&gt; -&lt;/span&gt;o a&lt;span class="operator"&gt;.&lt;/span&gt;out&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;# $(NVCC) -deviceemu  -I$(CUDA_INCLUDE_PATH) -L$(CUDA_LIB_PATH) $(CUDA_LIBS) -lm  main.cu -o a.out&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;clean&lt;span class="operator"&gt; :&lt;/span&gt;&lt;br /&gt;rm&lt;span class="operator"&gt; -&lt;/span&gt;f a&lt;span class="operator"&gt;.&lt;/span&gt;out&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1354055858592130241?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1354055858592130241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1354055858592130241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1354055858592130241'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda_25.html' title='Complex matrix inverse III: CUDA'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2064940060794925189</id><published>2010-04-25T15:28:00.000-07:00</published><updated>2010-04-29T21:03:12.460-07:00</updated><title type='text'>Complex matrix inverse II: CUDA</title><content type='html'>So, here is cumatrixtools.h&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include&amp;lt;cuComplex.h&amp;gt;&lt;br /&gt;#ifndef _CUMATRIXTOOLS_H_&lt;br /&gt;#define _CUMATRIXTOOLS_H_&lt;br /&gt;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt;&lt;br /&gt;cgeSquareMatrixProduct&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;out&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;B&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt;  )&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;,&lt;/span&gt;k&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;cuFloatComplex sum&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;  //sum = 0. + 0.*I;&lt;br /&gt;&lt;/span&gt;    sum&lt;span class="operator"&gt;  =&lt;/span&gt; make_cuFloatComplex&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;k&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;k&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;k&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;br /&gt;    sum&lt;span class="operator"&gt; =&lt;/span&gt;  cuCaddf&lt;span class="operator"&gt;(&lt;/span&gt;sum&lt;span class="operator"&gt;  ,&lt;/span&gt; cuCmulf&lt;span class="operator"&gt;(&lt;/span&gt;A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;k&lt;span class="operator"&gt;],&lt;/span&gt;B&lt;span class="operator"&gt;[&lt;/span&gt;k&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;]) );&lt;br /&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  out&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;] =&lt;/span&gt; sum&lt;span class="operator"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;//////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt;  *&lt;/span&gt;At&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt;  *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt; i&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt; i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt; i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt; j&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt; j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt; j&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;br /&gt;  At&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;] =&lt;/span&gt; A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;] ;&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;//                LU decomposition of complex matrices&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeDoolittle_LU_Decomposition&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;LU&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; n&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt; int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt; j&lt;span class="operator"&gt;,&lt;/span&gt; k&lt;span class="operator"&gt;,&lt;/span&gt; p&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;p_k&lt;span class="operator"&gt;, *&lt;/span&gt;p_row&lt;span class="operator"&gt;, *&lt;/span&gt;p_col&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;k&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt; k&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;n&lt;span class="operator"&gt;*&lt;/span&gt;n&lt;span class="operator"&gt;;&lt;/span&gt; k&lt;span class="operator"&gt;++)&lt;/span&gt; LU&lt;span class="operator"&gt;[&lt;/span&gt;k&lt;span class="operator"&gt;]=&lt;/span&gt;A&lt;span class="operator"&gt;[&lt;/span&gt;k&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;k&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; p_k&lt;span class="operator"&gt; =&lt;/span&gt; LU&lt;span class="operator"&gt;;&lt;/span&gt; k&lt;span class="operator"&gt; &amp;lt;&lt;/span&gt; n&lt;span class="operator"&gt;;&lt;/span&gt; p_k&lt;span class="operator"&gt; +=&lt;/span&gt; n&lt;span class="operator"&gt;,&lt;/span&gt; k&lt;span class="operator"&gt;++) {&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;    for&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;j&lt;span class="operator"&gt; =&lt;/span&gt; k&lt;span class="operator"&gt;;&lt;/span&gt; j&lt;span class="operator"&gt; &amp;lt;&lt;/span&gt; n&lt;span class="operator"&gt;;&lt;/span&gt; j&lt;span class="operator"&gt;++) {&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;       for&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;p&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; p_col&lt;span class="operator"&gt; =&lt;/span&gt; LU&lt;span class="operator"&gt;;&lt;/span&gt; p&lt;span class="operator"&gt; &amp;lt;&lt;/span&gt; k&lt;span class="operator"&gt;;&lt;/span&gt; p_col&lt;span class="operator"&gt; +=&lt;/span&gt; n&lt;span class="operator"&gt;,&lt;/span&gt;  p&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//           *(p_k + j) -= *(p_k + p) * *(p_col + j);&lt;br /&gt;&lt;/span&gt;&lt;span class="operator"&gt;       *(&lt;/span&gt;p_k&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;) =&lt;/span&gt; cuCsubf&lt;span class="operator"&gt;( *(&lt;/span&gt;p_k&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;) ,&lt;/span&gt; cuCmulf&lt;span class="operator"&gt;( *(&lt;/span&gt;p_k&lt;span class="operator"&gt; +&lt;/span&gt; p&lt;span class="operator"&gt;) , *(&lt;/span&gt;p_col&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;) ));&lt;br /&gt;    }&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;    if&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt; cuCabsf&lt;span class="operator"&gt;(*(&lt;/span&gt;p_k&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;)) !=&lt;/span&gt;&lt;span class="float"&gt; 0.0&lt;/span&gt;&lt;span class="operator"&gt; )&lt;/span&gt;&lt;span class="comment"&gt;  //return -1;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;    for&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;i&lt;span class="operator"&gt; =&lt;/span&gt; k&lt;span class="operator"&gt;+&lt;/span&gt;&lt;span class="int"&gt;1&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; p_row&lt;span class="operator"&gt; =&lt;/span&gt; p_k&lt;span class="operator"&gt; +&lt;/span&gt; n&lt;span class="operator"&gt;;&lt;/span&gt; i&lt;span class="operator"&gt; &amp;lt;&lt;/span&gt; n&lt;span class="operator"&gt;;&lt;/span&gt; p_row&lt;span class="operator"&gt; +=&lt;/span&gt; n&lt;span class="operator"&gt;,&lt;/span&gt; i&lt;span class="operator"&gt;++) {&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;       for&lt;/span&gt;&lt;span class="operator"&gt; (&lt;/span&gt;p&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 0&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; p_col&lt;span class="operator"&gt; =&lt;/span&gt; LU&lt;span class="operator"&gt;;&lt;/span&gt; p&lt;span class="operator"&gt; &amp;lt;&lt;/span&gt; k&lt;span class="operator"&gt;;&lt;/span&gt; p_col&lt;span class="operator"&gt; +=&lt;/span&gt; n&lt;span class="operator"&gt;,&lt;/span&gt; p&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;         // *(p_row + k) -= *(p_row + p) * *(p_col + k);&lt;br /&gt;&lt;/span&gt;&lt;span class="operator"&gt;    *(&lt;/span&gt;p_row&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;) =&lt;/span&gt; cuCsubf&lt;span class="operator"&gt;( *(&lt;/span&gt;p_row&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;) ,&lt;/span&gt; cuCmulf&lt;span class="operator"&gt;(  *(&lt;/span&gt;p_row&lt;span class="operator"&gt; +&lt;/span&gt; p&lt;span class="operator"&gt;) , *(&lt;/span&gt;p_col&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;) ));&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;         //*(p_row + k) /= *(p_k + k);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="operator"&gt;&lt;br /&gt;  *(&lt;/span&gt;p_row&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;) =&lt;/span&gt; cuCdivf&lt;span class="operator"&gt;( *(&lt;/span&gt;p_row&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;) , *(&lt;/span&gt;p_k&lt;span class="operator"&gt; +&lt;/span&gt; k&lt;span class="operator"&gt;)  );&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// Back substitution for lower triangular matrices assuming that the diagonal is filled with 1's&lt;br /&gt;// Given  T x = b ,&lt;br /&gt;// where T is a lower triangula matrix NxN with 1's in the diagonal&lt;br /&gt;// b is a known vector&lt;br /&gt;// x is an unknown vector&lt;br /&gt;// the routine otputs x = xout&lt;br /&gt;//////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeBackSubstitutionLowerDiagOne&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;xout&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;T&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;b&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; N&lt;span class="operator"&gt;  )&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cuFloatComplex bTemp&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  bTemp&lt;span class="operator"&gt; =&lt;/span&gt; b&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;i&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; bTemp&lt;span class="operator"&gt; =&lt;/span&gt; cuCsubf&lt;span class="operator"&gt;(&lt;/span&gt; bTemp&lt;span class="operator"&gt; ,&lt;/span&gt; cuCmulf&lt;span class="operator"&gt;(&lt;/span&gt;T&lt;span class="operator"&gt;[&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;],&lt;/span&gt; xout&lt;span class="operator"&gt;[&lt;/span&gt;j&lt;span class="operator"&gt;] ) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  xout&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;] =&lt;/span&gt; bTemp&lt;span class="operator"&gt; ;    &lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;/////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// Back substitution for upper triangular matrice&lt;br /&gt;////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeBackSubstitutionUpper&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;xout&lt;span class="operator"&gt;,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;T&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;b&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; N&lt;span class="operator"&gt;  )&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cuFloatComplex bTemp&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;N&lt;span class="operator"&gt;-&lt;/span&gt;&lt;span class="int"&gt;1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;--){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  bTemp&lt;span class="operator"&gt; =&lt;/span&gt; b&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;];&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;  for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;i&lt;span class="operator"&gt;+&lt;/span&gt;&lt;span class="int"&gt;1&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; bTemp&lt;span class="operator"&gt; =&lt;/span&gt; cuCsubf&lt;span class="operator"&gt;(&lt;/span&gt; bTemp&lt;span class="operator"&gt; ,&lt;/span&gt; cuCmulf&lt;span class="operator"&gt;(&lt;/span&gt;T&lt;span class="operator"&gt;[&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;],&lt;/span&gt; xout&lt;span class="operator"&gt;[&lt;/span&gt;j&lt;span class="operator"&gt;] ) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  xout&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;] =&lt;/span&gt; cuCdivf&lt;span class="operator"&gt;(&lt;/span&gt; bTemp&lt;span class="operator"&gt; ,&lt;/span&gt; T&lt;span class="operator"&gt;[&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; i&lt;span class="operator"&gt;] );    &lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;///////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeIdentity&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;Id&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;br /&gt;Id&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;j&lt;span class="operator"&gt;] =&lt;/span&gt; make_cuFloatComplex&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;0.f&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt;0.f&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;br /&gt;  Id&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;+&lt;/span&gt;i&lt;span class="operator"&gt;] =&lt;/span&gt; make_cuFloatComplex&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;1.f&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt;0.f&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;//////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;//  Inverse of a matrix using the triangularization of matrices&lt;br /&gt;//  Warning:&lt;br /&gt;//          It does not destroys the original matrix A&lt;br /&gt;//          A work space for 3 complex matrices must be supplied in W&lt;br /&gt;//////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; int&lt;/span&gt; cgeMatrixInverse_WorkSpace&lt;span class="operator"&gt;(){&lt;/span&gt;&lt;span class="flow"&gt; return&lt;/span&gt;&lt;span class="int"&gt; 3&lt;/span&gt;&lt;span class="operator"&gt;;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;__device__ __host__&lt;span class="keyword"&gt; static&lt;/span&gt; __inline__&lt;span class="type"&gt; void&lt;/span&gt; cgeMatrixInverse&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;inv&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;A&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt; ,&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;W&lt;span class="operator"&gt;)&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;Id&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;cuFloatComplex&lt;span class="operator"&gt; *&lt;/span&gt;invL&lt;span class="operator"&gt;, *&lt;/span&gt;invU&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Id&lt;span class="operator"&gt; =&lt;/span&gt; W&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;      //Double purpose work space&lt;br /&gt;&lt;/span&gt;  invL&lt;span class="operator"&gt; =&lt;/span&gt; W&lt;span class="operator"&gt; +&lt;/span&gt; N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;invU&lt;span class="operator"&gt; =&lt;/span&gt; W&lt;span class="operator"&gt; +&lt;/span&gt;&lt;span class="int"&gt; 2&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cgeIdentity&lt;span class="operator"&gt;(&lt;/span&gt; Id&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; cgeDoolittle_LU_Decomposition&lt;span class="operator"&gt;(&lt;/span&gt;inv&lt;span class="operator"&gt;,&lt;/span&gt;A&lt;span class="operator"&gt;,&lt;/span&gt;N&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt;   cgeBackSubstitutionLowerDiagOne&lt;span class="operator"&gt;(&lt;/span&gt; invL&lt;span class="operator"&gt; +&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; inv&lt;span class="operator"&gt; ,&lt;/span&gt; Id&lt;span class="operator"&gt; +&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt;  N&lt;span class="operator"&gt;  );&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++)&lt;/span&gt; cgeBackSubstitutionUpper&lt;span class="operator"&gt;(&lt;/span&gt; invU&lt;span class="operator"&gt; +&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; inv&lt;span class="operator"&gt; ,&lt;/span&gt; Id&lt;span class="operator"&gt; +&lt;/span&gt; i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt;  N&lt;span class="operator"&gt;  );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cgeSquareMatrixProduct&lt;span class="operator"&gt;(&lt;/span&gt;Id&lt;span class="operator"&gt; ,&lt;/span&gt; invL&lt;span class="operator"&gt; ,&lt;/span&gt; invU&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;  );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cgeTranspose&lt;span class="operator"&gt;(&lt;/span&gt;inv&lt;span class="operator"&gt; ,&lt;/span&gt; Id&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span class="pre"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#endif&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2064940060794925189?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2064940060794925189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2064940060794925189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2064940060794925189'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda-ii.html' title='Complex matrix inverse II: CUDA'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-9173818636522830943</id><published>2010-04-17T21:58:00.000-07:00</published><updated>2010-11-29T22:01:45.455-08:00</updated><title type='text'>Complex matrix Inverse I: CUDA</title><content type='html'>Here is a short program in &lt;span style="font-weight: bold;"&gt;CUDA&lt;/span&gt; to invert complex matrices through the LU decomposition (without permutations) with back substitution in __device__ mode.  This means that the whole inversion is designed to run in each thread.&lt;br /&gt;&lt;br /&gt;This code was adapted from a &lt;span style="font-weight: bold;"&gt;C&lt;/span&gt; code in real double precision found &lt;a href="http://mymathlib.webtrellis.net/matrices/linearsystems/"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code is standalone in the sense that it only requires the Standard tools provided by &lt;span style="font-weight: bold;"&gt;CUDA&lt;/span&gt; (without CuBlas) and tested in the NVIDIA GeForce 240M&lt;br /&gt;on a Linux Fedora 11.&lt;br /&gt;&lt;br /&gt;The program can be organized in three files&lt;br /&gt;&lt;ul&gt;&lt;li&gt;cumatrixtools.h:                 which contains the method itself.&lt;/li&gt;&lt;li&gt;cuinverse_kernel.cu:            which contains the kernel function, which maps the method on the threreads.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;main.cu:                     which administers the memory and calls  kernel function.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The purpose of this program is to invert several variations of a matrix A. The matrix A is passed to the kernel and the inverse is evaluated after modifying the first element of A. Each branch executes a different matrix. The kernel is called with &amp;lt;&amp;lt;&amp;lt;2,32&amp;gt;&amp;gt;&amp;gt;, which means that the threads are organized in two blocks, each bloch with 32 threads. The more physical processors one has, the more threads per block one could assign in order to gain performance&lt;br /&gt;&lt;br /&gt;The whole program is distributed in three posts (I,II and III)&lt;br /&gt;&lt;br /&gt;main.cu looks like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span class="pre"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;complex.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include&amp;lt;cuComplex.h&amp;gt;&lt;br /&gt;&lt;br /&gt;#include"cumatrixtools.h"&lt;br /&gt;#include"cuinverse_kernel.cu"&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;void&lt;/span&gt; cuPrintMatrix&lt;span class="operator"&gt;(&lt;/span&gt; cuFloatComplex&lt;span class="operator"&gt;  *&lt;/span&gt;C&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; N&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; M&lt;span class="operator"&gt; )&lt;br /&gt;{&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;,&lt;/span&gt;j&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++){&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;j&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;M&lt;span class="operator"&gt;;&lt;/span&gt;j&lt;span class="operator"&gt;++)&lt;/span&gt; printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;" (%f,%f)\t "&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt; cuCrealf&lt;span class="operator"&gt;(&lt;/span&gt;C&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;]) ,&lt;/span&gt; cuCimagf&lt;span class="operator"&gt;(&lt;/span&gt;C&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; +&lt;/span&gt; j&lt;span class="operator"&gt;]) );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;" \n "&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;&lt;br /&gt;///////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; N&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;3&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;     //Matrix dimension&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="keyword"&gt;const&lt;/span&gt;&lt;span class="type"&gt; int&lt;/span&gt; NBranches&lt;span class="operator"&gt; =&lt;/span&gt;&lt;span class="int"&gt; 64&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="comment"&gt;&lt;br /&gt;///////////////////////////////////////////////////////////////////////////////&lt;br /&gt;// Main program&lt;br /&gt;///////////////////////////////////////////////////////////////////////////////&lt;br /&gt;&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt;&lt;span class="keyword"&gt; main&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;int&lt;/span&gt; argc&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="type"&gt; char&lt;/span&gt;&lt;span class="operator"&gt; **&lt;/span&gt;argv&lt;span class="operator"&gt;){&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;&lt;br /&gt;int&lt;/span&gt; i&lt;span class="operator"&gt;;&lt;/span&gt;&lt;span class="type"&gt;&lt;br /&gt;float&lt;/span&gt;  complex A&lt;span class="operator"&gt;[&lt;/span&gt;&lt;span class="int"&gt;9&lt;/span&gt;&lt;span class="operator"&gt;] =&lt;/span&gt;&lt;span class="comment"&gt;  //  Base matrix&lt;br /&gt;&lt;/span&gt;&lt;span class="operator"&gt;    {&lt;/span&gt;&lt;span class="float"&gt;&lt;br /&gt;&lt;br /&gt;0.f&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt;/&lt;/span&gt;sqrtf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;2.f&lt;/span&gt;&lt;span class="operator"&gt;),&lt;/span&gt;&lt;span class="float"&gt; 0.0f&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt; I&lt;span class="operator"&gt;/&lt;/span&gt;sqrt&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;2.0f&lt;/span&gt;&lt;span class="operator"&gt;),&lt;/span&gt;&lt;span class="float"&gt;  0.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;&lt;span class="float"&gt; 0.&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;I&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="float"&gt;&lt;br /&gt;&lt;br /&gt;0.&lt;/span&gt;&lt;span class="operator"&gt; -&lt;/span&gt;I&lt;span class="operator"&gt;/&lt;/span&gt;&lt;span class="float"&gt;2.&lt;/span&gt;&lt;span class="operator"&gt;     ,&lt;/span&gt;&lt;span class="float"&gt; 0.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;I&lt;span class="operator"&gt;/&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;       ,&lt;/span&gt;&lt;span class="float"&gt;   0.&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt; I&lt;span class="operator"&gt;/&lt;/span&gt;sqrt&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;2.&lt;/span&gt;&lt;span class="operator"&gt;),&lt;br /&gt;-&lt;/span&gt;&lt;span class="float"&gt;0.5&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;I&lt;span class="operator"&gt; ,&lt;/span&gt;&lt;span class="float"&gt;  0.5&lt;/span&gt;&lt;span class="operator"&gt;+&lt;/span&gt;&lt;span class="float"&gt;0.&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;I&lt;span class="operator"&gt;  ,  -&lt;/span&gt;&lt;span class="float"&gt;1.&lt;/span&gt;&lt;span class="operator"&gt;/&lt;/span&gt;sqrt&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="float"&gt;2.&lt;/span&gt;&lt;span class="operator"&gt;)+.&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;*&lt;/span&gt;I&lt;span class="operator"&gt;&lt;br /&gt;&lt;br /&gt;};&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cuFloatComplex&lt;span class="operator"&gt;  *&lt;/span&gt;h_A&lt;span class="operator"&gt;, *&lt;/span&gt;h_invA&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;cuFloatComplex&lt;span class="operator"&gt;  *&lt;/span&gt;d_A&lt;span class="operator"&gt;, *&lt;/span&gt;d_invA&lt;span class="operator"&gt;,   *&lt;/span&gt;d_WorkSpace&lt;span class="operator"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"...allocating CPU memory.\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;h_A&lt;span class="operator"&gt; =          (&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *)&lt;/span&gt;   malloc&lt;span class="operator"&gt;(&lt;/span&gt;                              N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; ));&lt;/span&gt;&lt;br /&gt;h_invA&lt;span class="operator"&gt; =       (&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; *)&lt;/span&gt;   malloc&lt;span class="operator"&gt;(&lt;/span&gt;                    NBranches&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; ));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"...allocating GPU memory.\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaMalloc&lt;span class="operator"&gt;((&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt;&lt;span class="operator"&gt; **)&amp;amp;&lt;/span&gt;d_A&lt;span class="operator"&gt;,&lt;/span&gt;                                      NBranches&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; ));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaMalloc&lt;span class="operator"&gt;((&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt;&lt;span class="operator"&gt; **)&amp;amp;&lt;/span&gt;d_invA&lt;span class="operator"&gt;,&lt;/span&gt;                                   NBranches&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; ));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaMalloc&lt;span class="operator"&gt;((&lt;/span&gt;&lt;span class="type"&gt;void&lt;/span&gt;&lt;span class="operator"&gt; **)&amp;amp;&lt;/span&gt;d_WorkSpace&lt;span class="operator"&gt;,&lt;/span&gt; NBranches&lt;span class="operator"&gt;*&lt;/span&gt;cgeMatrixInverse_WorkSpace&lt;span class="operator"&gt;()*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt; ));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"...Copying memory.\n "&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="flow"&gt;&lt;br /&gt;for&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;i&lt;span class="operator"&gt;=&lt;/span&gt;&lt;span class="int"&gt;0&lt;/span&gt;&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;&amp;lt;&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;;&lt;/span&gt;i&lt;span class="operator"&gt;++ )&lt;/span&gt; h_A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;] =&lt;/span&gt; make_cuFloatComplex&lt;span class="operator"&gt;(&lt;/span&gt; crealf&lt;span class="operator"&gt;(&lt;/span&gt;A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;]) ,&lt;/span&gt; cimagf&lt;span class="operator"&gt;(&lt;/span&gt;A&lt;span class="operator"&gt;[&lt;/span&gt;i&lt;span class="operator"&gt;])  );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaMemcpy&lt;span class="operator"&gt;(&lt;/span&gt;d_A&lt;span class="operator"&gt;,&lt;/span&gt; h_A&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;cuFloatComplex&lt;span class="operator"&gt;) ,&lt;/span&gt; cudaMemcpyHostToDevice&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"...The base matrix is:\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;cuPrintMatrix&lt;span class="operator"&gt;(&lt;/span&gt; h_A&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt; );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n...Calling the kernel.\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaThreadSynchronize&lt;span class="operator"&gt;();&lt;/span&gt;&lt;br /&gt;cgeMatrixInverse_kernel&lt;span class="operator"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="int"&gt;2&lt;/span&gt;&lt;span class="operator"&gt;,&lt;/span&gt;&lt;span class="int"&gt;32&lt;/span&gt;&lt;span class="operator"&gt;&amp;gt;&amp;gt;&amp;gt;(&lt;/span&gt;d_invA&lt;span class="operator"&gt;,&lt;/span&gt; d_A&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt; ,&lt;/span&gt;d_WorkSpace&lt;span class="operator"&gt;);&lt;/span&gt;&lt;span class="comment"&gt;   // Divinding the 64 branches in 2 blocks of 32 threads&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;    cudaThreadSynchronize&lt;span class="operator"&gt;();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaMemcpy&lt;span class="operator"&gt;(&lt;/span&gt;h_invA&lt;span class="operator"&gt;,&lt;/span&gt; d_invA&lt;span class="operator"&gt;,&lt;/span&gt; NBranches&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt;*&lt;/span&gt;&lt;span class="keyword"&gt;sizeof&lt;/span&gt;&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="type"&gt;float&lt;/span&gt;&lt;span class="operator"&gt;),&lt;/span&gt; cudaMemcpyDeviceToHost&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n The inverse of the first branch is \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;cuPrintMatrix&lt;span class="operator"&gt;(&lt;/span&gt; h_invA&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt; );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n The inverse of the second branch is \n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;cuPrintMatrix&lt;span class="operator"&gt;(&lt;/span&gt; h_invA&lt;span class="operator"&gt; +&lt;/span&gt; N&lt;span class="operator"&gt;*&lt;/span&gt;N&lt;span class="operator"&gt; ,&lt;/span&gt; N&lt;span class="operator"&gt;,&lt;/span&gt; N&lt;span class="operator"&gt; );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n and so on ..\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;free&lt;span class="operator"&gt;(&lt;/span&gt;h_A&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;free&lt;span class="operator"&gt;(&lt;/span&gt;h_invA&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;cudaFree&lt;span class="operator"&gt;(&lt;/span&gt;d_A&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;cudaFree&lt;span class="operator"&gt;(&lt;/span&gt;d_invA&lt;span class="operator"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;cudaThreadExit&lt;span class="operator"&gt;();&lt;/span&gt;&lt;br /&gt;printf&lt;span class="operator"&gt;(&lt;/span&gt;&lt;span class="string"&gt;"\n-------------------------------------------------------\n"&lt;/span&gt;&lt;span class="operator"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-9173818636522830943?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/9173818636522830943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/9173818636522830943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/9173818636522830943'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/04/inverting-complex-matrices-with-cuda.html' title='Complex matrix Inverse I: CUDA'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-318744345920164771</id><published>2010-02-01T21:17:00.000-08:00</published><updated>2010-02-01T21:45:24.032-08:00</updated><title type='text'>Multidimensional Arrays</title><content type='html'>Linear algebra is very well developed with a vast literature in numerical methods. This not true for multi-dimensional arrays higher than 2, which correspond to the familiar matrices. In general it is difficult to generalize matrix operations to higher dimensions. One paper that gives an introduction to the topic and treats the problem of diagonalizing higher dimensional arrays is&lt;br /&gt;&lt;a href="http://www.i3s.unice.fr/%7Emh/RR/2007/RR-07.06-P.COMON.pdf"&gt;Tensor Diagonalization&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The literature usually refers multi-dimensional arrays as as Tensors, but I prefer to use the term &lt;span style="font-style: italic;"&gt;array&lt;/span&gt;, because in physics a tensor is more than a multidimensional array.&lt;br /&gt;&lt;br /&gt;The following figures correspond to an 9x9x9 array after and before a diagonalization attempt, with the application of orthogonal transformations.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_n_RyvlYppL4/S2e6EtUkTdI/AAAAAAAAAFs/L-KqTc0tKmE/s1600-h/array3Ddiag.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 283px; height: 320px;" src="http://4.bp.blogspot.com/_n_RyvlYppL4/S2e6EtUkTdI/AAAAAAAAAFs/L-KqTc0tKmE/s320/array3Ddiag.gif" alt="" id="BLOGGER_PHOTO_ID_5433516065493896658" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_n_RyvlYppL4/S2e5iDpSTOI/AAAAAAAAAFk/J5w6831ML1U/s1600-h/array3D.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 283px; height: 320px;" src="http://4.bp.blogspot.com/_n_RyvlYppL4/S2e5iDpSTOI/AAAAAAAAAFk/J5w6831ML1U/s320/array3D.gif" alt="" id="BLOGGER_PHOTO_ID_5433515470190955746" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-318744345920164771?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/318744345920164771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2010/02/multidimensional-arrays.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/318744345920164771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/318744345920164771'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2010/02/multidimensional-arrays.html' title='Multidimensional Arrays'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_n_RyvlYppL4/S2e6EtUkTdI/AAAAAAAAAFs/L-KqTc0tKmE/s72-c/array3Ddiag.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8848003694872027453</id><published>2009-12-19T06:33:00.000-08:00</published><updated>2009-12-19T09:16:31.887-08:00</updated><title type='text'>Benford's law</title><content type='html'>This is the probabilistic law that rules the distribution of de digits that appear in for example, our bills, bank statements, national debts, ..., where the digit 1 is seen as the most probable.&lt;br /&gt;&lt;br /&gt;The reason of this counter-intuitive law is that the natural underlying distribution is logarithmic. &lt;a href="http://en.wikipedia.org/wiki/Benford%27s_law"&gt;Benford's law&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When probabilities are involved, our intuition may catastrophically  lead us to  wrong conclusions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8848003694872027453?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8848003694872027453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/12/benfords-law.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8848003694872027453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8848003694872027453'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/12/benfords-law.html' title='Benford&apos;s law'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6886068722324869215</id><published>2009-12-13T20:29:00.000-08:00</published><updated>2009-12-14T01:03:24.924-08:00</updated><title type='text'>The Black-Scholes equation</title><content type='html'>I do not remember the first time I heard about the &lt;a href="http://en.wikipedia.org/wiki/Black%E2%80%93Scholes"&gt;Black-Scholes&lt;/a&gt; equation, but I finally fulfilled my curiosity. The Black-Scholes equation is a differential equation for the value of a contract that establishes the optional right  to buy (call options) or sell stocks (put options). The typical call option is a contract that gives the option to buy the stock at a certain point in the future T for a given strike price k. The value of the stock changes in time so that if I buy a call option written with a strike price k, I am betting that the price of the stock at time T will be higher than k (plus the cost of  the contract itself), so that I will be able to execute the transaction recovering the difference. Otherwise, I could let the contract expire, losing all the money I paid for the call option.&lt;br /&gt;&lt;br /&gt;The value of the contract is well know in the last day T, when the option can be executed because it is exactly the difference of price of the stock minus the strike price of the contract if the stock price is higher than k, otherwise, the contract's value is ZERO. The big problem is to estimate the fair value of the contract as a function of the stock price S and time t. Under certain assumptions, the value of the contract obeys the Black-Scholes partial differential equation.&lt;br /&gt;&lt;br /&gt;The figure below shows a typical solution of the Black-Scholes partial differential equation. The curve in red corresponds to the value of the contract at time T as a function of the stock price, acting as boundary condition. The remaining curves correspond to times farther and farther in the past. The strike price is k=120, the maturity time is T=1, the interest rate is r=0.05 and the volatility is sigma=0.5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_n_RyvlYppL4/SyXNB6udimI/AAAAAAAAAFc/60Rry56GvMI/s1600-h/BS.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 360px; height: 252px;" src="http://4.bp.blogspot.com/_n_RyvlYppL4/SyXNB6udimI/AAAAAAAAAFc/60Rry56GvMI/s400/BS.gif" alt="" id="BLOGGER_PHOTO_ID_5414959559810583138" border="0" /&gt;&lt;/a&gt;This is an example adapted from the book:&lt;br /&gt;&lt;i&gt;Computational Financial Mathematics using Mathematica&lt;/i&gt;, by Srdjan Stojanovic.&lt;br /&gt;&lt;br /&gt;Now, having a reasonable idea of the value of the contract, I can even buy and sell contracts!.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6886068722324869215?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6886068722324869215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/12/black-scholes-formula.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6886068722324869215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6886068722324869215'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/12/black-scholes-formula.html' title='The Black-Scholes equation'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_n_RyvlYppL4/SyXNB6udimI/AAAAAAAAAFc/60Rry56GvMI/s72-c/BS.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5028295809613818750</id><published>2009-12-08T17:05:00.000-08:00</published><updated>2009-12-16T21:29:11.925-08:00</updated><title type='text'>Functional Programming: MapReduce</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Functional_programming"&gt;Functional programming&lt;/a&gt; is a programming paradigm that was introduced by LISP. Many modern languages computational systems were inspired by LISP and one them is &lt;i&gt;Mathematica&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;It seems that the next biggest impact of functional programming is going to come from the application to parallel/distributed programming. One example of this emerging technology is the &lt;a href="http://en.wikipedia.org/wiki/MapReduce"&gt;MapReduce&lt;/a&gt; framework developed by Google. In similar way, Yahoo is developing &lt;a href="http://en.wikipedia.org/wiki/Hadoop"&gt;Haddop&lt;/a&gt; for the same purposes.&lt;br /&gt;Another example is of course the implementation of &lt;a href="http://www.wolframalpha.com/"&gt;WolframAlpha&lt;/a&gt; mostly developed in &lt;i&gt;Mathematica.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;There are many tutorials available including youtube videos such as&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=yjPBkvYh-ss"&gt; MapReduce Cluster Computing &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the implementations that called my attention is &lt;a href="http://www.cse.ust.hk/gpuqp/Mars.html"&gt;MARS&lt;/a&gt;, which is developed on the top of &lt;a href="http://en.wikipedia.org/wiki/CUDA"&gt;CUDA&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5028295809613818750?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5028295809613818750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/12/functional-programming.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5028295809613818750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5028295809613818750'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/12/functional-programming.html' title='Functional Programming: MapReduce'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4588498195372886013</id><published>2009-12-04T20:11:00.000-08:00</published><updated>2010-05-04T01:10:44.705-07:00</updated><title type='text'>Computational Linear Algebra</title><content type='html'>How do we implement programs that require linear algebra?&lt;br /&gt;For most of the cases there are no reasons to spent effort in developing our own libraries for linear algebra because we can use very good and freely available libraries.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The first layer is the Fortran &lt;a href="http://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms"&gt;BLAS&lt;/a&gt; library that implements matrix products. There are many variants of BLAS developed by certain companies and research institutions.&lt;/li&gt;&lt;li&gt;The second layer is the Fortran &lt;a href="http://en.wikipedia.org/wiki/LAPACK"&gt;Lapack&lt;/a&gt; library, which implements more advanced routines such as matrix decompositions and computation of eigenvalues on the top of BLAS. However, there are no high level routines such as matrix inverse, determinants, etc. The reason of the absence of these high level routines is that there are many ways to implement them in terms of the Lapack routines but one has to choose a particular method according to the  personal requirements for maximum efficiency. The implementation of programs in Lapack has high potential for efficiency optimization because one can specifies the  type of matrix in the operation ie. real, complex, symmetric, etc and the decomposition that fits better for the final purpose.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The third layer is the Blas/Lapack wrapper, which implements the operations that are taught in a first curse of Linear algebra. The routines in Lapack are usually taught in a second course of linear algebra.  The wrappers are easier to use but some of the flexibility is lost.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;For those who work with C, &lt;a href="http://www.gnu.org/software/gsl/"&gt;GSL&lt;/a&gt; must be the best option. For C++, one has the choice to use the &lt;a href="http://en.wikipedia.org/wiki/Boost_C%2B%2B_Libraries"&gt;Boost&lt;/a&gt; library, which includes a lot more than linear algebra. Personally, the library I really feel as the most friendly is the  &lt;a href="http://arma.sourceforge.net/"&gt;Armadillo&lt;/a&gt; C++ library for linear algebra.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4588498195372886013?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4588498195372886013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/12/computational-linear-algebra.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4588498195372886013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4588498195372886013'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/12/computational-linear-algebra.html' title='Computational Linear Algebra'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6615389284215150936</id><published>2009-11-19T01:02:00.000-08:00</published><updated>2009-11-21T20:30:55.431-08:00</updated><title type='text'>Magnetic sensors</title><content type='html'>One of the most important technologies with the most important applications is the ability to detect small magnetic fields. This allows us to make more compact hard disks and more recently more sensitive detectors, including bio-detectors.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Gigant Magneto Resistance (GMR) is one of the important effects responsible for these technologies that exploit the difference of electrical resistivity when the current traverses two different magnetic materials (separated by a very thin non-magnetic material) and the spins of the materials are parallel or anti-parallel. &lt;span style="text-decoration: underline;"&gt;&lt;/span&gt;&lt;a href="http://www.magnet.fsu.edu/education/tutorials/magnetacademy/gmr/"&gt;Giant Magnetoresistance: The Really Big Idea Behind a Very Tiny Tool &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The Tunnel Magnetoresistance effect (TM) , which relies in the quantum tunnel effect, is another important similar effect that can be even more sensitive. &lt;a href="http://en.wikipedia.org/wiki/Tunnel_magnetoresistance"&gt;Tunnel Magnetoresistance effect&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;There transmission of light in a gas such as Rubidium can be also very sensitive to very small external magnetic fields. &lt;a href="http://www.sciencecentric.com/news/article.php?q=07110213"&gt;Laser magnetometer&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;A link with some of these technologies applied to sensors is&lt;br /&gt;&lt;a href="http://www.gmrsensors.com/"&gt; GMR for sensors &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6615389284215150936?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6615389284215150936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/11/magnetic-sensors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6615389284215150936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6615389284215150936'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/11/magnetic-sensors.html' title='Magnetic sensors'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3384065051060226698</id><published>2009-10-28T23:52:00.001-07:00</published><updated>2011-11-08T23:01:22.888-08:00</updated><title type='text'>Geometric Optics with Lie Groups</title><content type='html'>&lt;a href="http://www.opticasoftware.com/about/DBResume.html"&gt;Donald Barnharth&lt;/a&gt;, from &lt;a href="http://www.opticasoftware.com/"&gt;Optical Software&lt;/a&gt; introduced me with&lt;br /&gt;another very interesting application of Lie groups in geometric optics.&lt;br /&gt;&lt;br /&gt;This should not be a surprise because geometric optics as well as classical mechanics can be expressed in terms of a variational principle. In classical mechanics we have the minimal action and in geometric optics we have Fermat's principle, which states that the trajectory of light rays minimize the optical path length defined as&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20%5CLambda%20%3D%20%5Cint_C%20n%20ds" /&gt;&lt;br /&gt;where &lt;span style="font-style: italic;"&gt;n &lt;/span&gt;is the refraction index, &lt;span style="font-style: italic;"&gt;ds &lt;/span&gt;is the differential arc length and &lt;span style="font-style: italic;"&gt;C &lt;/span&gt;is the path. The whole machinery of classical mechanics can be translated to geometric optics with the corresponding Hamiltonian formulation as the phase space formulation of geometric optics.&lt;br /&gt;&lt;br /&gt;The key idea of Hamiltonian mechanics is that the trajectory of the particles can be seen as active continuous symplectic transformations. For example, one has the following time-evolution operator&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20T%20%3D%20e%5E%7B%20t%5C%2C%20L_H%20%7D%20%3D%201%20%2B%20t%20L_H%20%2B%20%5Cfrac%7B1%7D%7B2%7D%20t%5E2%20L_H%5E2%2B..." /&gt;&lt;br /&gt;&lt;br /&gt;where &lt;span style="font-style: italic;"&gt;H &lt;/span&gt;is the Hamiltonian (independent of time), with the Lie operator defined in terms of the Poisson brackets as&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20L_H%20X%20%3D%20%5C%7B%20H%20%2C%20X%20%5C%7D%20" /&gt;&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20%5C%7B%20%20f%20%2C%20g%20%20%5C%7D%20%3D%20%5Csum_%7Bi%3D1%7D%5E%7BN%7D%20%5Cleft%5B%20%0D%0A%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20q_%7Bi%7D%7D%20%5Cfrac%7B%5Cpartial%20g%7D%7B%5Cpartial%20p_%7Bi%7D%7D%20-%0D%0A%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20p_%7Bi%7D%7D%20%5Cfrac%7B%5Cpartial%20g%7D%7B%5Cpartial%20q_%7Bi%7D%7D%0D%0A%5Cright%5D%0D%0A" /&gt;&lt;br /&gt;&lt;br /&gt;The same formalism can be applied to geometric optics with some particular adjustments. The time-evolution operator is replaced by the transformation that propagates the optical phase-state in the space. For practical applications this transformation is factorized in a perturbative-like product expansion that reminds the Fer expansion as&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20M%20%3D%20e%5E%7BL_%7Bf_1%7D%7De%5E%7BL_%7Bf_2%7D%7D..." /&gt;&lt;br /&gt;&lt;br /&gt;where, the first factor represents the para-axial approximation while the rest represent the corresponding higher order corrections.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://books.google.com/books?id=OPIzlipW9nwC&amp;amp;pg=PA33&amp;amp;lpg=PA33&amp;amp;dq=lagrangian+optics&amp;amp;source=bl&amp;amp;ots=fbUG05OEo9&amp;amp;sig=QKxCaViNvx2icqA-63U4awNMTuU&amp;amp;hl=en&amp;amp;ei=B03pSpmLGITl8AbG2tCNDw&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;ct=result&amp;amp;resnum=3&amp;amp;ved=0CBAQ6AEwAg#v=onepage&amp;amp;q=&amp;amp;f=false"&gt;V. Lakshminarayanan, Ajoy Ghatak, and K. Thyagarajan,  &lt;span style="font-style: italic;"&gt;Lagrangian Optics&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;a href="http://www.emis.de/journals/DMTCS/volumes/abstracts/pdfpapers/dm010111.pdf"&gt;Alex J. Dragt, &lt;span style="font-style: italic;"&gt;A Lie connection between Hamiltonian and&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Lagrangian optics&lt;br /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://books.google.com/books?id=KmpCDg-D39gC&amp;amp;pg=PA273&amp;amp;dq=geometric+optics+phase+space&amp;amp;ei=YMr0Sv74Oo6-yQS81IyABg&amp;amp;client=firefox-a#v=onepage&amp;amp;q=&amp;amp;f=false"&gt;Kurt B. Wolf, Geometric Optics on Phase Space, Springer, 2004&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;LaTeX was powered by &lt;a href="http://www.mathtran.org/"&gt;MathTran&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3384065051060226698?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3384065051060226698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/geometric-optics-with-lie-groups.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3384065051060226698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3384065051060226698'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/geometric-optics-with-lie-groups.html' title='Geometric Optics with Lie Groups'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3350099761389099017</id><published>2009-10-25T21:08:00.000-07:00</published><updated>2011-07-09T23:21:49.599-07:00</updated><title type='text'>Relativistic Many-body dynamics</title><content type='html'>An intuitive generalization of the explicitly covariant single-body relativistic dynamical equation to multiple multiple interacting particles is difficult. The no-go theorem of &lt;a href="http://www.ph.utexas.edu/fogs/sudarshan_symmetry.html"&gt;Currie Jordan and Sudarshan&lt;/a&gt;  is an example of the difficulties to device such explicitly covariant version of relativistic interacting particles.  I do not know if a satisfactory elegant solution was found.&lt;br /&gt;&lt;br /&gt;A book that explains this problem is&lt;br /&gt;&lt;br /&gt;FROM CLASSICAL TO&lt;br /&gt;QUANTUM MECHANICS&lt;br /&gt;Giampiero Esposito, Giuseppe Marmo&lt;br /&gt;&lt;br /&gt;Also see&lt;br /&gt;&lt;a href="http://prola.aps.org/abstract/PRD/v23/i10/p2210_1"&gt;Form of relativistic dynamics with world lines&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3350099761389099017?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3350099761389099017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/relativistic-many-body-dynamics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3350099761389099017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3350099761389099017'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/relativistic-many-body-dynamics.html' title='Relativistic Many-body dynamics'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2173705632366919740</id><published>2009-10-25T20:18:00.000-07:00</published><updated>2009-10-25T21:01:38.690-07:00</updated><title type='text'>The Lorentz-Dirac Force</title><content type='html'>There is a naive general idea that we already understand classical mechanics very well, but I do not think that is the case. There are many fundamental questions in classical mechanics without a satisfactory answer. One of them is the description of the trajectory of a charged particle in the presence of an electromagnetic field. Yes, we have the Lorentz force, but it does not take into account the effect of the radiation of the charged particle in the acceleration process. The Lorentz-Dirac force is an attempt to include the effect of the radiation but unfortunately, the solutions of this equation are pathological. Most books only mention this situation but Baylis's book in electrodynamics devotes a complete chapter this subject.&lt;br /&gt;&lt;a href="http://books.google.com/books?id=myD1IDTQlsoC&amp;amp;pg=PA304&amp;amp;dq=lorentz+dirac+force+baylis&amp;amp;ei=gBjlSr_wFoP2zQT2vMXnCw#v=onepage&amp;amp;q=lorentz%20dirac%20force%20baylis&amp;amp;f=false"&gt; Electrodynamics: a modern geometric approach&lt;br /&gt;By William Eric Baylis&lt;/a&gt; (chapter 12)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2173705632366919740?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2173705632366919740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/unfisished-classical-mechanics-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2173705632366919740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2173705632366919740'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/unfisished-classical-mechanics-i.html' title='The Lorentz-Dirac Force'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3839424431532850288</id><published>2009-10-25T06:09:00.000-07:00</published><updated>2009-10-25T07:19:45.299-07:00</updated><title type='text'>Returning from IMUC</title><content type='html'>I am finally writing again after my return from the magnificent International &lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;User Conference 2009, where I learned about the features of the future &lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;8 and met many people. I am going to devote a series of entries about IMUC 2009, but some general observations and things that I learned are&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;is growing and improving at an increasingly faster rate.&lt;/li&gt;&lt;li&gt;The new &lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;notebook will have nearly the same capacity found in LaTeX for creating static documents. However, is the dynamic capability what makes it revolutionary and much better than LaTeX.&lt;/li&gt;&lt;li&gt;The &lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;kernel is eventually going to support efficient tensor computation. These routines are going to be implemented in separated modules, so that Tensorial (the tensor package I develop with David Park and Jean-Francois Gouyet) will benefit from these new features. Moreover, now I have more ideas on  how to independently improve Tensorial.&lt;/li&gt;&lt;li&gt; The rendering of 3D images with &lt;a href="http://en.wikipedia.org/wiki/CUDA"&gt;CUDA&lt;/a&gt;  is truly amazing and I am waiting to play with it when it gets implemented in the kernel. Now I also know that my next laptop has to have an NVidia graphics card.&lt;/li&gt;&lt;li&gt;I am also waiting for the Mathematica plugin for web browsers, so that I can directly publish mathematica notebooks on the web without the need to export any html.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3839424431532850288?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3839424431532850288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/returning-from-imuc.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3839424431532850288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3839424431532850288'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/returning-from-imuc.html' title='Returning from IMUC'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7427292686646652849</id><published>2009-10-13T18:22:00.000-07:00</published><updated>2009-10-23T21:07:00.995-07:00</updated><title type='text'>Hyperdeterminants</title><content type='html'>The concept of hyperdeterminant is as new to me as a few days and is introducing me into a fascinating new branch of algebra that I did not even suspect. I am very familiar with tensors and how they can be seen as multidimensional arrays that generalize matrices, but the concept of hypermatrices goes further.&lt;br /&gt;&lt;br /&gt;The hyperdeterminant was invented (discovered) by the famous mathematician &lt;a href="http://en.wikipedia.org/wiki/Arthur_Cayley"&gt;Cayle&lt;/a&gt;, who gave us many things including the Cayle transform, useful to approximate the exponential of anti-Hermitian matrices, and the amazing &lt;a href="http://en.wikipedia.org/wiki/Cayley%E2%80%93Hamilton_theorem"&gt;Cayle-Hamilton theorem&lt;/a&gt; of linear algebra.&lt;br /&gt;&lt;br /&gt;There  is active research today and I even found a blog&lt;br /&gt;&lt;a href="http://hyperdeterminant.wordpress.com/2008/09/25/hello-world/"&gt; hyperdeterminant.wordpress.com &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More recently I found that Thomas Wolf and Sergey Tsarev are implemening serious computer work in order to find hyperdeterminants of higher order&lt;br /&gt;&lt;a hre="http://arxiv.org/PS_cache/arxiv/pdf/0903/0903.3864v2.pdf"&gt;Hyperdeterminants as integrable discrete systems&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;What I had in mind was the hypertederminant of at least 5x5x5 cubic matrices, but now I known this is an exceedingly difficult problem. Now my question is if there is one way to find a good approximation.&lt;br /&gt;&lt;br /&gt;MMM,.... I just, learned about other alternative definitions of hyperdeterminants, so the possibilities are still open.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7427292686646652849?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7427292686646652849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/hyperdeterminants.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7427292686646652849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7427292686646652849'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/hyperdeterminants.html' title='Hyperdeterminants'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8119935240751846703</id><published>2009-10-13T11:50:00.000-07:00</published><updated>2009-10-25T06:09:31.266-07:00</updated><title type='text'>Inverted Retina</title><content type='html'>If you did not know, we have our retinas &lt;i&gt;inverted&lt;/i&gt; in the sense that the light that enters our eyes has to pass through many layers of nerves, blood vessels and all the wiring before reaching the photo detectors themselves. Even more troublesome, is the fact that it seems that the images are completely distorted and blurred when they arrive the photo-detectors. However we surely know we can see very well. Why did we evolve this feature? and how do we really see? Some of the answers can be found in this absolutely amazing paper&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.springerlink.com/content/64r01725825u823m/"&gt;V. D. Svet and A. M. Khazen, &lt;i&gt;About the formation of an image in the inverted retina of the eye&lt;/i&gt;, Biophysics,  Volume 54, Number 2 / April, 2009, pp 193-203   &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The key point of this article is that we process the images in blocks. This means that we collect a sequence of images, which we process together in order to improve the signal/noise ratio.&lt;br /&gt;&lt;br /&gt;There is a recent independent article &lt;a href="http://www.newscientist.com/article/mg20427311.300-timewarp-how-your-brain-creates-the-fourth-dimension.html"&gt; here&lt;/a&gt;, suggesting that we actually see images in discrete sequences, which is completely consistent with Svet's theory.&lt;br /&gt;&lt;br /&gt;I met Dr Svet in Windsor, Canada, where he gave a few seminars about topics concerning sonar imaging and detection.  I expect to write more entries in my blog about other topics of his research.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8119935240751846703?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8119935240751846703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/inverted-retina.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8119935240751846703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8119935240751846703'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/inverted-retina.html' title='Inverted Retina'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7180205931358875255</id><published>2009-10-11T13:01:00.000-07:00</published><updated>2009-10-11T13:04:33.430-07:00</updated><title type='text'>What really matters is to challenge our brains</title><content type='html'>Our brains thrive when we learn new challenging things. It is not enough to practice what we already know well&lt;br /&gt;&lt;a href="http://www.newscientist.com/article/dn17957-learning-to-juggle-grows-brain-networks-for-good.html"&gt; Effect of challenging our brains in our brains &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7180205931358875255?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7180205931358875255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/what-really-matters-is-to-challenge-our.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7180205931358875255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7180205931358875255'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/what-really-matters-is-to-challenge-our.html' title='What really matters is to challenge our brains'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-586456710964031300</id><published>2009-10-10T21:52:00.000-07:00</published><updated>2009-10-10T22:03:20.249-07:00</updated><title type='text'>Rodolfo Sanchez Ph.D.</title><content type='html'>I was very glad to hear again from my old Bolivian friend Rodolfo Sanchez, who earned his Ph.D. degree in physics in Germany and now is working as a postdoctoral researcher at the GSI institute&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.uni-mainz.de/FB/Chemie/AK-Noertershaeuser/members/sanchez.html"&gt; Rodolfo Sanchez PhD &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This world in small because it happens that he is now collaborating with Dr Gordon Drake, who is professor at Windsor, Canada.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-586456710964031300?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/586456710964031300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/rodolfo-sanchez-phd.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/586456710964031300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/586456710964031300'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/rodolfo-sanchez-phd.html' title='Rodolfo Sanchez Ph.D.'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7369310149681261056</id><published>2009-10-10T01:21:00.000-07:00</published><updated>2009-10-10T01:33:14.599-07:00</updated><title type='text'>Tree Fractal</title><content type='html'>I was a little bit surprised to find one of my &lt;i&gt;Mathematica&lt;/i&gt; fractals as part of a collection of other fractals, as you can see in the October 17, 2004 entry&lt;br /&gt;&lt;br /&gt;&lt;a href="http://nylander.wordpress.com/2004/10/"&gt;http://nylander.wordpress.co/2004/10/ &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7369310149681261056?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7369310149681261056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/tree-fractal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7369310149681261056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7369310149681261056'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/tree-fractal.html' title='Tree Fractal'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6319575721540001858</id><published>2009-10-08T11:28:00.000-07:00</published><updated>2009-10-08T11:44:11.543-07:00</updated><title type='text'>Calculation of the unitary part of the Bures measure for N-level quantum systems</title><content type='html'>My paper about the Bures measure was published&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.iop.org/EJ/abstract/-search=66459121.1/1751-8121/42/44/445302"&gt;Calculation of the unitary part of the Bures measure for N-level quantum systems&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Bures measure can be written as the product of two factors. One corresponding to the populations and the other corresponding to the unitary transformation. Many people arrived to formulas for the Bures volume and the volume of the unitary part of the Bures measure, but in this paper we give an explicit expression of the measure itself in terms of even balls.&lt;br /&gt;&lt;br /&gt;Much more about measures is going to come the public very soon!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6319575721540001858?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6319575721540001858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/calculation-of-unitary-part-of-bures.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6319575721540001858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6319575721540001858'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/calculation-of-unitary-part-of-bures.html' title='Calculation of the unitary part of the Bures measure for N-level quantum systems'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8442247404254148933</id><published>2009-10-07T22:52:00.000-07:00</published><updated>2009-10-07T23:27:08.047-07:00</updated><title type='text'>Fisher Information In Natural Selection</title><content type='html'>I introduced myself with the concept of Fisher information in my readings about quantum estimation and the Cramer-Rao bound. It was when I read the book&lt;br /&gt;&lt;br /&gt;B. Roy Frieden, &lt;i&gt;Physics from Fisher Information: A Unification,&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;which showed me that the Fisher information may even play an important role in the foundations of physics itself. Unexpectedly, I run into the Fisher information again when I was reading about Jeffreys' prior for Bayesian estimation. Now, I came across with another interesting paper about the role of Fisher information in Natural selection&lt;br /&gt;&lt;br /&gt;Frank, S. A. 2009. Natural selection maximizes Fisher&lt;br /&gt;information. Journal of Evolutionary Biology 22:231–244&lt;br /&gt;&lt;br /&gt;Can we use this in order to refine genetic/evolutionary optimization algorithms?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8442247404254148933?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8442247404254148933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/fisher-information-in-natural-selection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8442247404254148933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8442247404254148933'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/fisher-information-in-natural-selection.html' title='Fisher Information In Natural Selection'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-7298244762028425228</id><published>2009-10-07T14:37:00.000-07:00</published><updated>2009-10-07T15:24:41.158-07:00</updated><title type='text'>Quantum estimation</title><content type='html'>Qantum estimation/metrology is a research field closely tied with quantum information theory.   Everything was born with the Heisenberg uncertainty principle, when we realized that in general measurements can be non-commutative in contrast with the classical world where everything is commutative i.e. the order of the measurements is irrelevant. The consequence of the non-commutativity is that two given observables may be incompatible for simultaneous arbitrarily precise measurements.&lt;br /&gt;&lt;br /&gt;The next step was done by Helstrom in the 70's who introduced the Symmetric Logarithmic Derivative (SLD) operator to obtain the Quantum Fisher information. It was later in the 80's when Wootters came with the refined and elegant concept of quantum statistical distinguishability, which was tied with the work of Helstrom by Braunstein and Caves (1994) in their famous paper &lt;a href="http://prola.aps.org/forward/PRL/v72/i22/p3439_1"&gt;Statistical distance and the geometry of quantum states&lt;/a&gt;. This paper is remarkable because it also established the connection with the completely independent work of Uhlmann about the Bures metric, which was born in the generalization of the Berry phase for mixed states.&lt;br /&gt;&lt;br /&gt;More recently, we witnessed many important developments in the quantum single parameter estimation with one unexpected twist. Now we know that quantum mechanics and in particular quantum entanglement have the potential to defeat their classical estimation methods in the quest for higher precision.  For example, you can see my older post about NOON states and quantum interferometry.&lt;br /&gt;&lt;br /&gt;However, this new knowledge cannot be applied in the real world until we learn how to generate a considerable number of entangled states in a reliable way.&lt;br /&gt;&lt;br /&gt;You can also see my wikipedia article about the &lt;a href="http://en.wikipedia.org/wiki/Bures_metric"&gt;Bures metric&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-7298244762028425228?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/7298244762028425228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/quantum-estimation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7298244762028425228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/7298244762028425228'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/quantum-estimation.html' title='Quantum estimation'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-365215270671018604</id><published>2009-10-06T23:14:00.000-07:00</published><updated>2009-10-08T08:40:25.328-07:00</updated><title type='text'>Learning from being wrong</title><content type='html'>Being wrong seems to be something to avoid, but it may be the price to pay if we want to improve or optimize something. This is the general philosophy behind Genetic/Evolutionary algorithms and even statistical sampling.&lt;br /&gt;&lt;br /&gt;In Genetic/Evolutionar algorithms, the key ingredient is the introduction of mutation. In most cases a mutation will be destructive, but there will be occasions when the mutation will be beneficial. We improve by discarding the destructive mutations, while keeping the beneficial ones.&lt;br /&gt;&lt;br /&gt;It was Thomas Bäck from &lt;a href="http://natcomp.liacs.nl/"&gt; Leiden University &lt;/a&gt; who told us how Toyota promotes mutation in the production system in order to make more efficient cars.&lt;br /&gt;&lt;br /&gt;In statistical sampling, the objective is to explore the space of a probability distribution (explore the opportunities). Here we have the Metropolis (and Metropolis-Hastings) algorithm, where one is forced to be wrong sometimes in order to explore the probability distribution.&lt;br /&gt;&lt;br /&gt;Ben Schumacher, the author of the quantum noiseless coding theorem has something to tell about this&lt;br /&gt;&lt;a href="http://bulletin.kenyon.edu/x2497.xml"&gt; Ben Schumacher on "Being wrong" &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Disclaimer: The only way to profit from being wrong (mutate) is to be ready to correct ourselves as fast as possible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-365215270671018604?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/365215270671018604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/learning-from-being-wrong.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/365215270671018604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/365215270671018604'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/learning-from-being-wrong.html' title='Learning from being wrong'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8286441677623188370</id><published>2009-10-04T17:12:00.000-07:00</published><updated>2009-10-04T17:29:26.365-07:00</updated><title type='text'>A scientific approach to science education</title><content type='html'>In 2006, when I was in Windsor, I had the opportunity to meet Carl Wieman, the winner of the physics Nobel price in 2001 for his experimental work in the production of the Bose-Einstein condensate. However, something that called my attention even more was his research and discoveries about science education. He showed us with experimental data how our current approach is far for being the most efficient way to teach science. Even worse, sometimes teaching science as we do it today, leads to students with even more misconceptions!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.scientificblogging.com/cwieman"&gt;More about his research in education can be found HERE&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8286441677623188370?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8286441677623188370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/scientific-approach-to-science.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8286441677623188370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8286441677623188370'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/scientific-approach-to-science.html' title='A scientific approach to science education'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-2596263502567693806</id><published>2009-10-03T14:18:00.000-07:00</published><updated>2011-11-10T13:10:17.220-08:00</updated><title type='text'>Quantum/Classical transition</title><content type='html'>The nature of the quantum/classical transition is according to my opinion, the most important fundamental question of physics. There are many approaches and many insights that have consequences on the continuing debate on the interpretation of quantum mechanics and its mysterious features such as the collapse of the wave function. Some of the approaches and related topics, not necessarily independent from each other are &lt;br /&gt;&lt;ol&gt;&lt;li&gt;The Ehrenfest theorem (My favorite).&lt;/li&gt;&lt;li&gt; The Koopman- von Neumann equation for the classical wave function.&lt;/li&gt;&lt;li&gt;The Wigner function for a formulation in the phase space.&lt;/li&gt;&lt;li&gt;Very realed with the previous approach is the &lt;a href="http://en.wikipedia.org/wiki/Moyal_bracket"&gt;Moyal bracket&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Weyl_quantization"&gt;Weyl quantization&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Feynman Path integrals and decoherence. &lt;/li&gt;&lt;li&gt;The classical spinor formalism. &lt;a href="http://books.google.com/books?id=myD1IDTQlsoC&amp;amp;pg=PP1&amp;amp;dq=Electrodynamics:+a+modern+geometric+approach++By+William+Eric+Baylis&amp;amp;ei=0MPHSqO8DoeCygTE7M2BBA#v=onepage&amp;amp;q=&amp;amp;f=false"&gt;Electrodynamics: a modern geometric approach By William Eric Baylis&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The limit to the Thomas-Fermi model by &lt;a href="http://prola.aps.org/abstract/RMP/v53/i4/p603_1"&gt;Elliott H. Lieb&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The analogy of classical statistical mechanics with quantum mechanics inspired on the Wigner function by&amp;nbsp; &lt;a href="http://iopscience.iop.org/0038-5670/20/8/R03/pdf/PHU_20_8_R03.pdf"&gt;Blokhintsev.&lt;/a&gt; Another researcher, &lt;a href="http://books.google.com/books/about/Quantum_classical_correspondence.html?id=xTafy9uEZvgC"&gt;A. O. Bolivar&lt;/a&gt; pursues this idea further but it seems that he was unaware of the previous work by Blokhintsev.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Related with the previous approach is also the work by Amir Caldeira and Anthony J. Leggett, who proposed a &lt;a href="http://en.wikipedia.org/wiki/Quantum_dissipation"&gt;quantum dissipation model&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;The very intriguing derivation of the Schrodinger equation from classical mechanics with complexified Brownian motion by &lt;a href="http://prola.aps.org/abstract/PR/v150/i4/p1079_1"&gt;Edward Nelson&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;a href="http://arxiv.org/abs/quant-ph/0412015"&gt;The p-mechanics formalism&lt;/a&gt;, which exploits the representations of the Heisemberg. This method is also closely related with the Weyl quantization.&lt;/li&gt;&lt;li&gt; &lt;a href="http://en.wikipedia.org/wiki/Geometric_quantization"&gt;Geometric quantization&lt;/a&gt;, is another method inspired on the Weyl quantization trying to maintain a coordinate-free procedure based on differential geometry.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-2596263502567693806?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/2596263502567693806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/quantumclassical-transition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2596263502567693806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/2596263502567693806'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/quantumclassical-transition.html' title='Quantum/Classical transition'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5219412309658940606</id><published>2009-10-02T23:57:00.000-07:00</published><updated>2009-10-05T17:59:13.819-07:00</updated><title type='text'>The creation of the universe in 6 days</title><content type='html'>And God created the universe in 6 days, but in order to give us a nice sky full of beautiful shiny stars, he decided to simulate the light as though as it was coming from thousands, millions and billions of years ago in the past. This was necessary because the speed of light is so fast that in 6 days there would be no chances for us to see anything, not even the light  from our closest star, excepting our own sun. We would not be able to see the Milky Way as we see it today, not even in 6 thousand years.&lt;br /&gt;&lt;br /&gt;However, God did his job so well that there is no way for anybody to find any hint of crack in the simulation. Unfortunately, this implies that humans will never be able to prove that the universe was created in 6 days, no matter how hard they could try.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5219412309658940606?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5219412309658940606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/creation-of-universe-in-6-days.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5219412309658940606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5219412309658940606'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/creation-of-universe-in-6-days.html' title='The creation of the universe in 6 days'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5153247530527428473</id><published>2009-10-02T21:31:00.000-07:00</published><updated>2009-10-02T22:05:31.411-07:00</updated><title type='text'>Shannons's noisy-chanel coding theorem</title><content type='html'>This is an amazing theorem that completely defies intuition and lies at the core of classical information theory. One way to defeat the noise is to encode the original information with added redundancy. The price to pay is a reduction on the efficiency of transmission, also called transmission rate. Intuition says that as the communication error goes to zero, through redundancy coding, the transmission rate should go to zero as well. NOT TRUE!. Shannon actually found a finite bound for the transmission rate, even as the communication error goes to zero.&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Noisy-channel_coding_theorem"&gt;http://en.wikipedia.org/wiki/Noisy-channel_coding_theorem&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5153247530527428473?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5153247530527428473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/shannonss-noisy-chanel-coding-theorem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5153247530527428473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5153247530527428473'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/shannonss-noisy-chanel-coding-theorem.html' title='Shannons&apos;s noisy-chanel coding theorem'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6663846362207352474</id><published>2009-10-02T14:11:00.000-07:00</published><updated>2009-10-02T14:27:14.678-07:00</updated><title type='text'>Princeton Physics Plasma Laboratory</title><content type='html'>The director of the &lt;a href="http://www.pppl.gov/"&gt;Princeton Physics Plasma Laboratory&lt;/a&gt;, Stewart Prager, gave today an overview presentation about the research carried out in the institution. They design and construct &lt;a href="http://en.wikipedia.org/wiki/Tokamak"&gt; tokamaks &lt;/a&gt; for nuclear fusion and collaborate with other institutions and projects such as &lt;a href="http://en.wikipedia.org/wiki/ITER"&gt; ITER.&lt;/a&gt;. After seeing the steady progress in this research field, I am much more optimistic about the feasibility to have one day a commercial energy generator plant based in nuclear fusion. Something that also called me the attention was the importance of Lithium as coating material for the inner surfaces of the plasma chamber.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6663846362207352474?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6663846362207352474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/10/princeton-physics-plasma-laboratory.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6663846362207352474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6663846362207352474'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/10/princeton-physics-plasma-laboratory.html' title='Princeton Physics Plasma Laboratory'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-8738221820766898447</id><published>2009-09-30T12:13:00.000-07:00</published><updated>2009-09-30T21:51:07.186-07:00</updated><title type='text'>Quantum Interferometer</title><content type='html'>Jonathan Dowling from Louisiana State University gave a presentation about the use of entangled photons  for high precision interferometry [1] showing that they can lead to much better measurements than it is possible with classical light. These entangled photon states are of the form&lt;br /&gt;&lt;img src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=%5Cdisplaystyle%20%7C%20%5CPsi_%7BNOON%7D%20%5Crangle%20%3D%20%5Cfrac%7B1%7D%7B%5Csqrt%7B2%7D%7D%28%20%7C%20N%200%20%5Crangle%20%2B%20e%5E%7Bi%5Ctheta%20N%7D%20%7C%200%20N%20%5Crangle%29" /&gt;&lt;br /&gt;Some problems remain such as the difficulty to produce NOON states with high power, but they are very promising anyway.&lt;br /&gt;&lt;br /&gt;So far they devised how to make ingenious conditional measurements in order to generate NOON states.&lt;br /&gt;&lt;br /&gt;Another important topic was the emulation of non-linear effects by conditional measurements within linear optics [2].&lt;br /&gt;&lt;br /&gt;Refererences&lt;ol&gt;&lt;br /&gt;&lt;li&gt;J Dowling &lt;a href="http://arxiv.org/abs/0904.0163"&gt;arXiv:0904.0163&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; G. G. Lapaire1, et al, Conditional linear-optical measurement schemes generate effective photon nonlinearities DOI: 10.1103/PhysRevA.68.042314&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/url?sa=t&amp;amp;source=web&amp;amp;ct=res&amp;amp;cd=1&amp;amp;ved=0CAsQFjAA&amp;amp;url=http%3A%2F%2Fphys.lsu.edu%2F%7Ejdowling%2Ftalks%2FRochester07.ppt&amp;amp;ei=ysPDSsTsBsuZ8AaJuoHgCQ&amp;amp;usg=AFQjCNG-Rldj1ac3IGz5WwvF2wMqYJzWpQ&amp;amp;sig2=9utIpKbgboPLehxx1oTqPw"&gt;Jonathan Dowling ppt presentation &lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;LaTeX was possible in this entry with &lt;a href="http://www.mathtran.org/"&gt;MathTran&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-8738221820766898447?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/8738221820766898447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-interferometer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8738221820766898447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/8738221820766898447'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-interferometer.html' title='Quantum Interferometer'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4688754521359483715</id><published>2009-09-26T09:11:00.000-07:00</published><updated>2009-09-26T09:36:20.244-07:00</updated><title type='text'>Human chromosome 2</title><content type='html'>Humans have 23 chromosomes while all the other hominids have 24 chromosomes. The question is, how can this be possible if we are suppose to have a common ancestor. Now we know that human chromosome 2 is the result of the fusion of two chromosomes found in our relative hominids.&lt;br /&gt;&lt;a href="http://www.youtube.com/watch?v=x-WAHpC0Ah0"&gt;YouTube:Chromosome 2&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4688754521359483715?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4688754521359483715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/human-chromosome-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4688754521359483715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4688754521359483715'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/human-chromosome-2.html' title='Human chromosome 2'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-98550746241192072</id><published>2009-09-25T14:18:00.000-07:00</published><updated>2009-09-25T14:27:45.450-07:00</updated><title type='text'>Quantum Feedback Control</title><content type='html'>&lt;a href="http://www.quantum.umb.edu/Jacobs/"&gt;Kurt Jacobs&lt;/a&gt; gave a presentation about &lt;i&gt;Quantum Feedback Control&lt;/i&gt;. He showed how to introduce the action of weak continuous measurements into a master equation that. This equation resembles the Lindblad equation with an extra stochastic term, where the feedback can be introduced in the Hamiltonian. One application was to create a cat state of a harmonic oscillator.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-98550746241192072?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/98550746241192072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-feedback-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/98550746241192072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/98550746241192072'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-feedback-control.html' title='Quantum Feedback Control'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-6463555872887348728</id><published>2009-09-25T00:11:00.000-07:00</published><updated>2009-09-25T14:39:00.207-07:00</updated><title type='text'>Adiabatic quantum complexity</title><content type='html'>The adiabatic quantum computer was proposed in &lt;a href="http://arxiv.org/abs/quant-ph/0001106v1"&gt;arXiv:quant-ph/0001106v1&lt;/a&gt; in order to solve certain type of problems.&lt;br /&gt;&lt;br /&gt;For low dimensions it was shown that the adiabatic quantum computer is polynomial, for a certain problem with exponential complexity in a classical computer. Peter Young, who gave a presentation at Princeton yesterday, is using Quantum Montecarlo Simuations, as used in statistical mechanics for the partition function, in order to engage this problem for higher dimensions where direct simulations are not feasible.&lt;br /&gt;&lt;a href="http://physics.ucsc.edu/%7Epeter/talks/MIT.pdf"&gt;The Complexity Of The Quantum Adiabatic Algorithm &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-6463555872887348728?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/6463555872887348728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/adiabatic-quantum-complexity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6463555872887348728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/6463555872887348728'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/adiabatic-quantum-complexity.html' title='Adiabatic quantum complexity'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5667851494314073244</id><published>2009-09-23T09:09:00.000-07:00</published><updated>2009-09-23T10:49:04.179-07:00</updated><title type='text'>Intelligence gene</title><content type='html'>The following article seems to indicate that there is a gene that is associated with higher intelligence, but those who have it are in disadvantage in high pressure exams&lt;br /&gt;&lt;a href="http://www.newscientist.com/article/dn17837-gene-for-memory-and-iq-gives-students-low-grades.html"&gt; memory gene &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5667851494314073244?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5667851494314073244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/intelligence-gene.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5667851494314073244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5667851494314073244'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/intelligence-gene.html' title='Intelligence gene'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4621868092097181722</id><published>2009-09-22T18:18:00.000-07:00</published><updated>2009-09-22T18:22:14.773-07:00</updated><title type='text'>Epigenetics</title><content type='html'>Epigenetics studies the effect of the environment on the expression of genes. A saw the following NOVA tv program&lt;br /&gt;&lt;a href="http://www.pbs.org/wgbh/nova/genes/issa.html"&gt;http://www.pbs.org/wgbh/nova/genes/issa.html&lt;/a&gt;&lt;br /&gt;and I was very surprised.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4621868092097181722?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4621868092097181722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/epigenetics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4621868092097181722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4621868092097181722'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/epigenetics.html' title='Epigenetics'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-452379964919210254</id><published>2009-09-22T15:34:00.000-07:00</published><updated>2009-09-22T16:15:40.199-07:00</updated><title type='text'>LaTeX in my blog</title><content type='html'>I want to write equations in my blog, so I found &lt;a href="http://www.forkosh.dreamhost.com/source_mimetex.html"&gt;mimetex&lt;/a&gt;, but I could not run it from the cgi Princeton server. I do not know why. I may need to set up complicated permissions or there is a compatibility issue between mimetex and the cgi server. &lt;br /&gt;&lt;br /&gt;Here I am testing the cgi provided by mimetex&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.forkosh.dreamhost.com/mimetex.cgi?c=\sqrt{a^2+b^2}" alt="" border=0 align=middle&gt;&lt;br /&gt;&lt;br /&gt;It works, but I can only use it as a test.&lt;br /&gt;&lt;br /&gt;Another method, less elegant though, is using &lt;a href="http://www.mathtran.org"&gt;MathTran&lt;/a&gt;, which I used to make the following equation&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=\displaystyle%20Q%20%3D%201-2%20%7C%20n%20%5Crangle%20%5Clangle%20n%20%7C"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 157px; height: 24px;" src="http://www.mathtran.org/cgi-bin/mathtran?D=3;tex=\displaystyle%20Q%20%3D%201-2%20%7C%20n%20%5Crangle%20%5Clangle%20n%20%7C" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-452379964919210254?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/452379964919210254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/latex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/452379964919210254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/452379964919210254'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/latex.html' title='LaTeX in my blog'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3224936657148710550</id><published>2009-09-21T21:37:00.000-07:00</published><updated>2009-09-21T21:46:12.269-07:00</updated><title type='text'>Quantum mechanics in plants??</title><content type='html'>Profesor Gregory D. Scholes gave a presentation in Princeton about the possible role of quantum mechanical effects in the absorption of light and energy transfer in photosynthetic processes in plants.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nature.com/nature/journal/v431/n7006/full/431256a.html"&gt;www.nature.com/nature/journal/v431/n7006/full/431256a.html &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This seems to be very controversial because they claim high coherence at room temperature. Personally I find it difficult to believe it but I'll wait and see more developments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3224936657148710550?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3224936657148710550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-mechanics-in-plants.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3224936657148710550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3224936657148710550'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/quantum-mechanics-in-plants.html' title='Quantum mechanics in plants??'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1504821408844348814</id><published>2009-09-21T20:40:00.000-07:00</published><updated>2009-09-21T20:46:34.879-07:00</updated><title type='text'>PkPd</title><content type='html'>PKPD stands for Pharmacokinetic/Pharmacodynamic and it seems to be one of the most fruitful research areas in the boundaries between mathematics, statistics, chemistry and BIOLOGY.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Pharmacodynamics"&gt;http://en.wikipedia.org/wiki/Pharmacodynamics &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Particularly, I am mostly interested in the modeling with differential equations and the use of control theory.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1504821408844348814?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1504821408844348814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/pkpd.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1504821408844348814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1504821408844348814'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/pkpd.html' title='PkPd'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-199689710780970442</id><published>2009-09-21T20:21:00.000-07:00</published><updated>2009-09-21T20:31:51.778-07:00</updated><title type='text'>Alpha</title><content type='html'>Alpha is what they call  knowledge data base&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.wolframalpha.com/"&gt;http://www.wolframalpha.com/ &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The difference from regular search engines is is designed to deliver well formatted data.&lt;br /&gt;&lt;br /&gt;For example, using "Dow Jones" it gives a very nice page with graphs, which can be downloaded along with the raw data from a &lt;span style="font-style: italic;"&gt;Mathematica &lt;/span&gt;notebook.&lt;br /&gt;&lt;br /&gt;The &lt;b&gt;Dow Jones Industrial Average&lt;/b&gt; is one of the most important indexes in Wall street.&lt;br /&gt;&lt;br /&gt;In the same way one can download the information for specific companies such as Toyota or Microsoft.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-199689710780970442?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/199689710780970442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/alpha.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/199689710780970442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/199689710780970442'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/alpha.html' title='Alpha'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-3429547978954748061</id><published>2009-09-21T16:09:00.000-07:00</published><updated>2009-09-21T16:16:29.660-07:00</updated><title type='text'>International Mathematica User Conference 2009</title><content type='html'>I am going to give an oral presentation at the International Mathematica User Conference 2009 in Champaign Illinois. October 22-24.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.wolfram.com/news/events/userconf2009/presentations.html"&gt; List of presentations &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My presentation is going to be about my package developed for performing Magnus expansions. This expansion can be used to find approximate solutions for systems of linear equations and linear operators in general&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Magnus_expansion"&gt; Magnus expansion in Wikipedia &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-3429547978954748061?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/3429547978954748061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/international-mathematica-user.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3429547978954748061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/3429547978954748061'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/international-mathematica-user.html' title='International Mathematica User Conference 2009'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-4045212444077773271</id><published>2009-09-20T10:48:00.000-07:00</published><updated>2009-09-20T10:54:25.775-07:00</updated><title type='text'>Entanglement measure</title><content type='html'>I developed a very nice method to measure the entanglement of pure states&lt;br /&gt;&lt;br /&gt;Renan Cabrera, Herschel Rabitz,  The landscape of quantum transitions driven by single-qubit unitary transformations with implications for entanglement, J. Phys. A: Math. Theor. 42 (2009) 275303.&lt;br /&gt;&lt;br /&gt;doi: 10.1088/1751-8113/42/27/275303&lt;br /&gt;&lt;br /&gt;This method is based in the measurement of the Bures distance between a given state and the closest separable state, which allows one to calculate the generalized Schmidt state. The entanglement can be measured from the coefficients of this Schmidt state.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-4045212444077773271?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/4045212444077773271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/entanglement-measure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4045212444077773271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/4045212444077773271'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/entanglement-measure.html' title='Entanglement measure'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-5398307887387995946</id><published>2009-09-20T10:41:00.000-07:00</published><updated>2009-09-21T20:57:45.298-07:00</updated><title type='text'>Bures measure</title><content type='html'>My paper about the calculation of the unitary part of the Bures measure was recently accepted for publication&lt;br /&gt;&lt;br /&gt;Renan Cabrera, Herschel Rabitz, &lt;i&gt;Calculation of the Unitary part of the Bures Measure for N-level Quantum Systems &lt;/i&gt;,  Accepted at J. Phy A: Math. Theor.  &lt;br /&gt;&lt;br /&gt;This paper shows how the Bures measure can be expressed as the product of the measure of even euclidean balls. This means that we now have a simple and easy formula for sampling. The ultimate application will be in Bayesian quantum estimation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My wikipedia article that explains the basics of the Bures metric is&lt;br /&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Bures_metric"&gt;http://en.wikipedia.org/wiki/Bures_metric &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-5398307887387995946?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/5398307887387995946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/bures-measure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5398307887387995946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/5398307887387995946'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/bures-measure.html' title='Bures measure'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-422539974263902925</id><published>2009-09-20T10:24:00.000-07:00</published><updated>2010-05-13T20:50:29.253-07:00</updated><title type='text'>Group theory for wireless communications</title><content type='html'>The technology of transmission of information between multiple antennas began to develop 10 years ago. The purpose is to increase the fidelity and transmission rate between multiple sources and multiple receptors.&lt;br /&gt;&lt;br /&gt;The particular technology that I am interested mostly is in the &lt;i&gt;Unitary Space-Time Codes (UST)&lt;/i&gt;. In this technology, the information is encoded in blocks spanning space and time. In the simplest case, we could think of N antennas with a sequence of N pulses, so that the information block can be  represented as an NxN complex matrix.  It is mathematically convenient to use unitary matrices, so the name  UST  is justified in this case.&lt;br /&gt;&lt;br /&gt;Inside the UST field I am paying attention to the Cayley encoding [1,2,3] because it seems to be elegant, simple and easy to understand.&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;ol&gt;&lt;li&gt; &lt;a href="http://authors.library.caltech.edu/1817/1/JINieeetsp03.pdf"&gt; Cayley Differential Unitary Space-Time Codes by B. Hochwald, B. Hassibi&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://authors.library.caltech.edu/1817/1/JINieeetsp03.pdf"&gt;Unitary space-time modulation via Cayley transform by Y Jing, B Hassibi&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://thesis.library.caltech.edu/3369/"&gt;Yindi Jing Thesis&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Representation Theory for High-Rate Multiple-Antenna Code Design by B. Hassibi, B. Hochwald, A. Shokrollahi, W. Sweldens&lt;/li&gt;&lt;li&gt;Differential Unitary Space-Time Modulation by B. Hochwald, W. Sweldens&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.nowpublishers.com/product.aspx?product=CIT&amp;amp;doi=0100000001"&gt;Random Matrices for &lt;span id="_ctl9_results"&gt;&lt;span class="cmssbx-10x-x-160"&gt;Wireless Communications&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; A. Tulino, S. Verdu (at Princeton) &lt;/li&gt;&lt;li&gt;Circuits for Wireless Communications: Selected Readingsby Banlue Srisuchinwong (Editor), Wanlop Surakampontorn (Editor), Sawasd Tantaratana (Editor)&lt;/li&gt;&lt;li&gt; Space-time coding for broadband wireless communications by By Georgios B. Giannakis, Zhiqiang Liu&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.lcs.poli.usp.br/isssta2006/tutorial_T4.pdf"&gt;Random Matrices For Wireless Communications I &lt;/a&gt;&lt;a href="http://www.egr.uh.edu/Courses/ECE/ECE4371/ECE6111_files/random-matrix-3.pdf"&gt; &lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.egr.uh.edu/Courses/ECE/ECE4371/ECE6111_files/random-matrix-3.pdf"&gt;Random Matrices For Wireless Communications II&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;More information can be found at Bell labs&lt;br /&gt;&lt;br /&gt;&lt;a href="http://mars.bell-labs.com/"&gt; http://mars.bell-labs.com/ &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More applications of group theory in engineering can be found at&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.usna.edu/Users/math/wdj/repn_thry_appl.htm%20"&gt;http://www.usna.edu/Users/math/wdj/repn_thry_appl.htm &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-422539974263902925?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/422539974263902925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/diverse-applications-of-group-theory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/422539974263902925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/422539974263902925'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/diverse-applications-of-group-theory.html' title='Group theory for wireless communications'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-839192421527479486.post-1591620320349733063</id><published>2009-09-20T06:29:00.000-07:00</published><updated>2009-09-21T13:21:29.098-07:00</updated><title type='text'>Greetings</title><content type='html'>Hi, My name is Renan Cabrera L.&lt;br /&gt;&lt;br /&gt;I am a physicist interested in quantum mechanics, group theory, and science in general.&lt;br /&gt;&lt;br /&gt;My web page is&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.princeton.edu/~rcabrera/"&gt;  Renan Cabrera's Web Page  &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/839192421527479486-1591620320349733063?l=rcabreral.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://rcabreral.blogspot.com/feeds/1591620320349733063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://rcabreral.blogspot.com/2009/09/greetings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1591620320349733063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/839192421527479486/posts/default/1591620320349733063'/><link rel='alternate' type='text/html' href='http://rcabreral.blogspot.com/2009/09/greetings.html' title='Greetings'/><author><name>Renan Cabrera L. Ph.D.</name><uri>http://www.blogger.com/profile/01274204455427708304</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
