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

<channel>
	<title>Manfredas Zabarauskas&#039; Blog</title>
	<atom:link href="http://blog.zabarauskas.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zabarauskas.com</link>
	<description>We are what we repeatedly do; excellence, then, is not an act but a habit. -- Aristotle</description>
	<lastBuildDate>Wed, 13 Jan 2010 16:27:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unplugged in G</title>
		<link>http://blog.zabarauskas.com/unplugged-in-g/</link>
		<comments>http://blog.zabarauskas.com/unplugged-in-g/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 00:03:09 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[electrophoresis]]></category>
		<category><![CDATA[guitar]]></category>
		<category><![CDATA[unplugged]]></category>
		<category><![CDATA[vacation]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=413</guid>
		<description><![CDATA[Another vacation, another video &#8211; as usual, apologies for the sound, webcam and playing quality. Three days left &#8217;till the journey back to Cambridge.
Vacation status: haven&#8217;t even touched anything related to Computer Science. On the other hand, brushed up on complex trigonometry/logarithms and series expansions (read: maths), and feel reasonably happy to discuss plant evolution [...]]]></description>
			<content:encoded><![CDATA[<p><em>Another vacation, another video &#8211; as usual, apologies for the sound, webcam and playing quality. Three days left &#8217;till the journey back to Cambridge.</em></p>
<p><small><div class="wp-caption alignright" style="width: 236px"><img class=" " title="Gel electrophoresis of Senecio vulgaris, S. squalidus and S. cambrensis DNA strands." src="http://blog.zabarauskas.com/img/electrophoresis.jpg" alt="Gel electrophoresis of Senecio vulgaris, S. squalidus and S. cambrensis DNA strands." width="226" height="164" /><p class="wp-caption-text"><a href='http://en.wikipedia.org/wiki/Agarose_gel_electrophoresis'>Gel electrophoresis</a> of <i>Senecio vulgaris, S. squalidus</i> and <i>S. cambrensis</i> DNA strands.</p></div></small>Vacation status: haven&#8217;t even touched anything related to Computer Science. On the other hand, brushed up on complex trigonometry/logarithms and series expansions (read: <em>maths</em>), and feel reasonably happy to discuss plant evolution through polyploidy (read: <em>biology</em>, see: <em>picture on the right</em>).</p>
<p>Post-vacation status update: apparently I <i>did</i> have to discuss plant evolution through polyploidy in my exam! What were the odds&#8230;</p>
<p>Anyway, here&#8217;s the video. Oh, yes, and while we&#8217;re at it &#8211; happy New Year to you all.<br />
<small><br />
<div class="wp-caption alignleft" style="width: 340px"><br />
<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/X5A40WV9QWU&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/X5A40WV9QWU&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object><p class="wp-caption-text">Eric Clapton - Wonderful Tonight (0:00/3:50), <br/>Guns N' Roses - Wild Horses (3:54/6:16).</p></div></small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/unplugged-in-g/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>It Literally Pays Off to Do Homework in Cambridge</title>
		<link>http://blog.zabarauskas.com/it-literally-pays-off-to-do-homework-in-cambridge/</link>
		<comments>http://blog.zabarauskas.com/it-literally-pays-off-to-do-homework-in-cambridge/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 21:18:07 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[cambridge university]]></category>
		<category><![CDATA[mips]]></category>
		<category><![CDATA[prize]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=377</guid>
		<description><![CDATA[
&#160;
45 minutes, 28 MIPS instructions and £25.
Computer Science FTW.
&#160;
# Copyright Manfredas Zabarauskas, 2009.
# MIPS routine that reads an array of ten integers
# and prints the sorted array to console.
.text
main:   sub $t7, $sp, 40
l_read: li $v0, 5
        syscall
        sw $v0, [...]]]></description>
			<content:encoded><![CDATA[<p><small><div class="wp-caption alignleft" style="width: 590px"><img title="Well done! - joint shortest traditional (and practical :-) sort for the OS1a prize tick." src="http://blog.zabarauskas.com/img/sort.jpg" alt="Well done! - joint shortest traditional (and practical :-) sort for the OS1a prize tick." width="580" height="258" /><p class="wp-caption-text">&quot;Well done! - joint shortest traditional (and practical :<b></b>-) sort for the OS1a prize tick&quot;. Cambridge, 2009.</p></div></small></p>
<div style="clear: both;">&nbsp;<br />
45 minutes, 28 MIPS instructions and £25.<br />
Computer Science FTW.<br />
&nbsp;</div>
<pre># Copyright Manfredas Zabarauskas, 2009.
# MIPS routine that reads an array of ten integers
# and prints the sorted array to console.
.text
main:   sub $t7, $sp, 40
l_read: li $v0, 5
        syscall
        sw $v0, 0($t7)
        add $t7, $t7, 4
        bne $t7, $sp, l_read
l_out:  sub $t8, $sp, 36
        sub $t7, 40
l_inn:  add $t8, $t8, 4
        lw $t2, -8($t8)
        lw $t3, -4($t8)
        ble $t2, $t3, no_swp
        sw $t2, -4($t8)
        sw $t3, -8($t8)
        move $t7, $sp
no_swp: bne $t8, $sp, l_inn
        beq $t7, $sp, l_out
l_prnt: li $v0, 11
        li $a0, 10
        syscall
        li $v0, 1
        lw $a0, 0($t7)
        syscall
        add $t7, $t7, 4
        bne $t7, $sp, l_prnt
        li $v0, 10
        syscall
</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/it-literally-pays-off-to-do-homework-in-cambridge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eigenfaces Tutorial</title>
		<link>http://blog.zabarauskas.com/eigenfaces-tutorial/</link>
		<comments>http://blog.zabarauskas.com/eigenfaces-tutorial/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 16:43:22 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[eigenface]]></category>
		<category><![CDATA[eigenfaces]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=286</guid>
		<description><![CDATA[The main purpose behind writing this tutorial was to provide a more detailed set of instructions for someone who is trying to implement an eigenface based face detection or recognition systems. It is assumed that the reader is familiar (at least to some extent) with the eigenface technique as described in the original M. Turk [...]]]></description>
			<content:encoded><![CDATA[<p><i>The main purpose behind writing this tutorial was to provide a more detailed set of instructions for someone who is trying to implement an eigenface based face detection or recognition systems. It is assumed that the reader is familiar (at least to some extent) with the eigenface technique as described in the original M. Turk and A. Pentland papers (see &#8220;References&#8221; for more details). </i></p>
<h3>Introduction</h3>
<p>The idea behind eigenfaces is similar (to a certain extent) to the one behind the periodic signal representation as a sum of simple oscillating functions in a <a href="http://en.wikipedia.org/wiki/Fourier_series" target="_blank">Fourier decomposition</a>. The technique described in this tutorial, as well as in the original papers, also aims to represent a face as a linear composition of the base images (called the eigenfaces).</p>
<p>The recognition/detection process consists of initialization, during which the eigenface basis is established and face classification, during which a new image is projected onto the &#8220;face space&#8221; and the resulting image is categorized by the weight patterns as a known-face, an unknown-face or a non-face image.</p>
<h3>Demonstration</h3>
<p>To <a href="http://www.zabarauskas.com/downloads/Eigenfaces.zip">download</a> the software shown in video for 32-bit x86 platform, click <a href="http://www.zabarauskas.com/downloads/Eigenfaces.zip">here</a>. It was compiled using Microsoft Visual C++ 2008 and uses <a href="http://www.gnu.org/software/gsl/" target="_blank">GSL</a> for Windows.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/YWRiF7FAuKE&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YWRiF7FAuKE&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<h3>Establishing the Eigenface Basis</h3>
<p>First of all, we have to obtain a training set of <img src="http://blog.zabarauskas.com/wp-content/cache/tex_69691c7bdcc3ce6d5d8a1361f22d04ac.png" align="absmiddle" class="tex" alt="M" /> grayscale face images  <img src="http://blog.zabarauskas.com/wp-content/cache/tex_89a934fc176ed09fa49252cf10f8957c.png" align="absmiddle" class="tex" alt="I_1, I_2, ..., I_M" />. They should be:</p>
<ol>
<li> face-wise aligned, with eyes in the same level and faces of the same scale,</li>
<li> normalized so that every pixel has a value between 0 and 255 (i.e. one byte per pixel encoding), and</li>
<li>of the same <img src="http://blog.zabarauskas.com/wp-content/cache/tex_cd94a3641bb6ba72c90dd0d8f4d2e199.png" align="absmiddle" class="tex" alt="N \times N" /> size.</li>
</ol>
<p>So just capturing everything formally, we want to obtain a set:</p>
<p><center><img src="http://blog.zabarauskas.com/wp-content/cache/tex_d1b806dc65ca4bcb76dfc062ae060be5.png" align="absmiddle" class="tex" alt="\{ I_1, I_2, ..., I_M \}" />, where <img src="http://blog.zabarauskas.com/wp-content/cache/tex_f08f417ca9693bf48ed20d5708b6f9c7.png" align="absmiddle" class="tex" alt="I_k = \begin{bmatrix} p_{1,1}^k &amp; p_{1,2}^k &amp; ... &amp; p_{1,N}^k \\ p_{2,1}^k &amp; p_{2,2}^k &amp; ... &amp; p_{2,N}^k \\ \vdots \\ p_{N,1}^k &amp; p_{N,2}^k &amp; ... &amp; p_{N,N}^k \end{bmatrix}_{N \times N}" /> and <img src="http://blog.zabarauskas.com/wp-content/cache/tex_f025d7635bbe720a4b66adccea31ddd3.png" align="absmiddle" class="tex" alt="0 \leq p_{i,j}^k \leq 255." /></center></p>
<p>Once we have that, we should change the representation of a face image <img src="http://blog.zabarauskas.com/wp-content/cache/tex_bc6d0de85e84afdaf232791d9aafa398.png" align="absmiddle" class="tex" alt="I_k" /> from a <img src="http://blog.zabarauskas.com/wp-content/cache/tex_cd94a3641bb6ba72c90dd0d8f4d2e199.png" align="absmiddle" class="tex" alt="N \times N" /> matrix, to a <img src="http://blog.zabarauskas.com/wp-content/cache/tex_067beafbfe4c5e47df74c436264c5493.png" align="absmiddle" class="tex" alt="\Gamma_k" /> point in <img src="http://blog.zabarauskas.com/wp-content/cache/tex_ec4ad94a9be87109217fcd9d10ebcd52.png" align="absmiddle" class="tex" alt="N^2" />-dimensional space. Now here is how we do it: <span id="more-286"></span>we concatenate all the rows of the matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_bc6d0de85e84afdaf232791d9aafa398.png" align="absmiddle" class="tex" alt="I_k" /> into one big vector of dimension <img src="http://blog.zabarauskas.com/wp-content/cache/tex_ec4ad94a9be87109217fcd9d10ebcd52.png" align="absmiddle" class="tex" alt="N^2" />. Can it get any more simpler than that?</p>
<p>This is how it looks formally:</p>
<p><center><img src="http://blog.zabarauskas.com/wp-content/cache/tex_39c24b1755e3c06f42b365c62a282ccb.png" align="absmiddle" class="tex" alt="\Gamma_k = \begin{bmatrix} p_{1,1}^k \\ p_{1,2}^k \\ \vdots \\ p_{1,N}^k \\ p_{2,1}^k \\ p_{2,2}^k \\ \vdots \\ p_{2,N}^k \\ \vdots \\ p_{N,1}^k \\ p_{N,2}^k \\ \vdots \\ p_{N,N}^k \end{bmatrix}_{N \times 1}" />, where  <img src="http://blog.zabarauskas.com/wp-content/cache/tex_0d577846ec877dc57a43942af2f5919f.png" align="absmiddle" class="tex" alt="k = 1, ..., M" /> and <img src="http://blog.zabarauskas.com/wp-content/cache/tex_7810a75f664cc78102b11f42972062e3.png" align="absmiddle" class="tex" alt="p_{i,j}^k \in I_k" /></center></p>
<p>Since we are much more interested in the characteristic features of those faces, let&#8217;s subtract everything what is common between them, i.e. the <strong>average face</strong>.<br />
The average face of the previous mean-adjusted images can be defined as <img src="http://blog.zabarauskas.com/wp-content/cache/tex_2ee5b10fa3153fc3dfe076869222c7d8.png" align="absmiddle" class="tex" alt="\Psi = {{1}\over{M}} \sum_{i=1}^{M} \Gamma_i" />, then each face differs from the average by the vector <img src="http://blog.zabarauskas.com/wp-content/cache/tex_e6b4043d66e1baf4d6839f0bc51c4107.png" align="absmiddle" class="tex" alt="\Phi_i = \Gamma_i - \Psi" />.</p>
<p>Now we should attempt to find a set of orthonormal vectors which best describe the distribution of our data. The necessary steps in this at a first glance daunting task would seem to be:</p>
<ol>
<li>Obtain a <a href="http://en.wikipedia.org/wiki/Covariance_matrix" target="_blank">covariance matrix</a><br />
<img src="http://blog.zabarauskas.com/wp-content/cache/tex_cc75d8834aff897124eaf1ef8e60fa1d.png" align="absmiddle" class="tex" alt="C = {{1}\over{M}} \sum_{i=1}^{M} \Phi_i \Phi_i^T = AA^T" />, where <img src="http://blog.zabarauskas.com/wp-content/cache/tex_95e05c29c4d2ed0d862144b734d1200b.png" align="absmiddle" class="tex" alt="A = \left[ \Phi_1 \Phi_2 ... \Phi_M \right]" />.</li>
<li>Find the eigenvectors <img src="http://blog.zabarauskas.com/wp-content/cache/tex_c96b59279af8b06034c43473c16ab01d.png" align="absmiddle" class="tex" alt="u_k" /> and eigenvalues <img src="http://blog.zabarauskas.com/wp-content/cache/tex_8ff9c1b69b4201fec1b23780372d5cdf.png" align="absmiddle" class="tex" alt="\lambda_k" /> of <img src="http://blog.zabarauskas.com/wp-content/cache/tex_0d61f8370cad1d412f80b84d143e1257.png" align="absmiddle" class="tex" alt="C" />.</li>
</ol>
<p>However, note two things here: <img src="http://blog.zabarauskas.com/wp-content/cache/tex_7fc56270e7a70fa81a5935b72eacbe29.png" align="absmiddle" class="tex" alt="A" /> is of the size <img src="http://blog.zabarauskas.com/wp-content/cache/tex_f538d8e85c63fd7582add2d8672562b2.png" align="absmiddle" class="tex" alt="N^2 \times M" /> and hence the matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_0d61f8370cad1d412f80b84d143e1257.png" align="absmiddle" class="tex" alt="C" /> is of the size <img src="http://blog.zabarauskas.com/wp-content/cache/tex_72af584bfe05bf85e4d69e506a3b4675.png" align="absmiddle" class="tex" alt="N^2 \times N^2" />. To put things into perspective &#8211; if your image size is <img src="http://blog.zabarauskas.com/wp-content/cache/tex_7967136cf815c43bf428b85d8f990a4b.png" align="absmiddle" class="tex" alt="128 \times 128" />, then the size of the matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_0d61f8370cad1d412f80b84d143e1257.png" align="absmiddle" class="tex" alt="C" /> would be <img src="http://blog.zabarauskas.com/wp-content/cache/tex_782e66b36998bb9fadf2b50c5ae2d775.png" align="absmiddle" class="tex" alt="16384 \times 16384" />. Determining eigenvectors and eigenvalues for a matrix this size would be an absolutely intractable task!</p>
<p>So how do we go about it? A simple mathematical trick: first let&#8217;s calculate the inner product matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_9779c443501e95b557b4661bba870560.png" align="absmiddle" class="tex" alt="L = A^T A" />, of the size <img src="http://blog.zabarauskas.com/wp-content/cache/tex_93ff99aa85b95038b1d2748d250caf4d.png" align="absmiddle" class="tex" alt="M \times M" />. Then let&#8217;s find it&#8217;s eigenvectors <img src="http://blog.zabarauskas.com/wp-content/cache/tex_4f430d84ae7eb54df6bfe4a906af6638.png" align="absmiddle" class="tex" alt="v_i, i = 1, ..., M" /> of <img src="http://blog.zabarauskas.com/wp-content/cache/tex_d20caec3b48a1eef164cb4ca81ba2587.png" align="absmiddle" class="tex" alt="L" /> (of the <img src="http://blog.zabarauskas.com/wp-content/cache/tex_69691c7bdcc3ce6d5d8a1361f22d04ac.png" align="absmiddle" class="tex" alt="M" />-th dimension). Now observe, that if <img src="http://blog.zabarauskas.com/wp-content/cache/tex_d3c618cc46f1a82db89606012cd75043.png" align="absmiddle" class="tex" alt="L v_i = \lambda_i v_i" />, then</p>
<p><center><img src="http://blog.zabarauskas.com/wp-content/cache/tex_c1882247ef593606f0485b400c87bcf4.png" align="absmiddle" class="tex" alt="\begin{array} {rcl} A L v_i &amp;=&amp; \lambda_i A v_i \Rightarrow \\ A A^T A v_i &amp;=&amp; \lambda_i A v_i \Rightarrow \\ C A v_i &amp;=&amp; \lambda_i A v_i \end{array}" />,</center></p>
<p>and hence <img src="http://blog.zabarauskas.com/wp-content/cache/tex_ce45a4315a74df24a9d46ff33119fd69.png" align="absmiddle" class="tex" alt="u_i = A v_i" /> and <img src="http://blog.zabarauskas.com/wp-content/cache/tex_5614371f803f8a78b18b27391549a107.png" align="absmiddle" class="tex" alt="\lambda_i" /> are respectively the <img src="http://blog.zabarauskas.com/wp-content/cache/tex_69691c7bdcc3ce6d5d8a1361f22d04ac.png" align="absmiddle" class="tex" alt="M" /> eigenvectors (of <img src="http://blog.zabarauskas.com/wp-content/cache/tex_ec4ad94a9be87109217fcd9d10ebcd52.png" align="absmiddle" class="tex" alt="N^2" />-th dimension) and eigenvalues of <img src="http://blog.zabarauskas.com/wp-content/cache/tex_0d61f8370cad1d412f80b84d143e1257.png" align="absmiddle" class="tex" alt="C" />. Make sure to normalize <img src="http://blog.zabarauskas.com/wp-content/cache/tex_eb00a04135562ae6f74786f084f54327.png" align="absmiddle" class="tex" alt="u_i" />, such that <img src="http://blog.zabarauskas.com/wp-content/cache/tex_11ab4920d9be82d30e3c4c1fa3fbea30.png" align="absmiddle" class="tex" alt="\left\| u_i \right\| = 1" />.</p>
<p>We will call these eigenvectors <img src="http://blog.zabarauskas.com/wp-content/cache/tex_eb00a04135562ae6f74786f084f54327.png" align="absmiddle" class="tex" alt="u_i" /> the <strong>eigenfaces</strong>. Scale them to 255 and render on the screen, to see why.</p>
<p>It turns out that quite a few eigenfaces with the smallest eigenvalues can be discarded, so leave only the <img src="http://blog.zabarauskas.com/wp-content/cache/tex_3fe4ce6c661e7015ff4e5c3054260ab8.png" align="absmiddle" class="tex" alt="R \leq M" /> ones with the largest eigenvalues (i.e. only the ones making the greatest contribution to the variance of the original image set) and chuck them into the matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_1f1a76aa21ad1b9ba4e2bf48d2879611.png" align="absmiddle" class="tex" alt="U = \left[ u_1 u_2 ... u_R \right]_{N \times R}" /></p>
<p>After you have done that &#8211; congratulations! We won&#8217;t need anything else, but the matrix <img src="http://blog.zabarauskas.com/wp-content/cache/tex_4c614360da93c0a041b22e537de151eb.png" align="absmiddle" class="tex" alt="U" /> for the next steps &#8211; face detection and classification.</p>
<h3>Face Classification Using Eigenfaces</h3>
<p>Once the eigenfaces are created, a new face image <img src="http://blog.zabarauskas.com/wp-content/cache/tex_07710b5c43702a8bb7b9104eacc6ba71.png" align="absmiddle" class="tex" alt="\Gamma" /> can be transformed into it&#8217;s eigenface components by a simple operation:</p>
<p><center><img src="http://blog.zabarauskas.com/wp-content/cache/tex_1358890c107de0ec0ab7637e1d6a01a4.png" align="absmiddle" class="tex" alt="\Omega = U^T (\Gamma - \Psi) =  \begin{bmatrix} \omega_1 \\ \omega_2 \\ \vdots \\ \omega_R \end{bmatrix}_{R \times 1}" />.</center></p>
<p>The weights <img src="http://blog.zabarauskas.com/wp-content/cache/tex_eb948b1c50831e30722aa00670819bc4.png" align="absmiddle" class="tex" alt="\omega_i \in \Omega" /> describe the contribution of each eigenface in representing the input face image. We can use this vector for <strong>face recognition</strong> by finding the smallest <a href="http://en.wikipedia.org/wiki/Euclidean_distance">Euclidean distance</a> <img src="http://blog.zabarauskas.com/wp-content/cache/tex_c64243adb5cde4ced701f126265899d5.png" align="absmiddle" class="tex" alt="\epsilon_{rec}" /> between the input face and training faces weight vectors, i.e. by calculating <img src="http://blog.zabarauskas.com/wp-content/cache/tex_3bb3e0a287a6f7f61935fcea0b7a7b94.png" align="absmiddle" class="tex" alt="\epsilon_{rec} = min \left\| \Omega - \Omega_i \right\|" />. If <img src="http://blog.zabarauskas.com/wp-content/cache/tex_8b19a3eb9d689b6f139f6cfb61c9d98a.png" align="absmiddle" class="tex" alt="\epsilon_{rec} &lt; \Theta_{rec}" />, where <img src="http://blog.zabarauskas.com/wp-content/cache/tex_8d7bfd80a860b12ebb430bc051573049.png" align="absmiddle" class="tex" alt="\Theta_{rec}" /> is a treshold chosen heuristically, then we can say that the input image is recognized as the image with which it gives the lowest score.</p>
<p>The weights vector can also be used for an unknown <strong>face detection</strong>, exploiting the fact that the images of faces do not change radically when projected into the face space, while the projection of non-face images appear quite different. To do so, we can calculate the distance <img src="http://blog.zabarauskas.com/wp-content/cache/tex_2283e0ad240100f5a6953e6efd2cc06f.png" align="absmiddle" class="tex" alt="\epsilon_{det}" /> from the mean-adjusted input image <img src="http://blog.zabarauskas.com/wp-content/cache/tex_f1833047ad4f5ada395df8a2903b641c.png" align="absmiddle" class="tex" alt="\Phi = \Gamma - \Psi" /> and its projection onto face space <img src="http://blog.zabarauskas.com/wp-content/cache/tex_79041fdea0a0f2e4a7c83d2d9c63b38a.png" align="absmiddle" class="tex" alt="\Phi_f = \sum_{i=1}^R \omega_i u_i " />, i.e. <img src="http://blog.zabarauskas.com/wp-content/cache/tex_d3bfb48a60d5ec7f9ad1a45312aeb636.png" align="absmiddle" class="tex" alt="\epsilon_{det} = \left\| \Phi - \Phi_f \right\|" />. Again, if <img src="http://blog.zabarauskas.com/wp-content/cache/tex_484af1868e0f0a277c80f62f06d6b4b2.png" align="absmiddle" class="tex" alt="\epsilon_{det} &lt; \Theta_{det}" /> for some treshold <img src="http://blog.zabarauskas.com/wp-content/cache/tex_94ade02ef424d4e009df3fe9720e1992.png" align="absmiddle" class="tex" alt="\Theta_{det}" /> (also obtained heuristically, for example, by observing <img src="http://blog.zabarauskas.com/wp-content/cache/tex_2283e0ad240100f5a6953e6efd2cc06f.png" align="absmiddle" class="tex" alt="\epsilon_{det}" /> for an input set consisting only of face images and a set of non-face images) we can conclude that the input image is a face.</p>
<h3>References</h3>
<p>1. Face Recognition Using Eigenfaces, Matthew A. Turk and Alex P. Pentland, MIT Vision and Modeling Lab, CVPR ‘91.<br />
2. Eigenfaces for Recognition, Matthew A. Turk and Alex P. Pentland, Journal of Cognitive Neuroscience ‘91.<br />
3. <a href="http://www.scholarpedia.org/article/Eigenfaces" target="_blank">Eigenfaces</a>. Sheng Zhang and Matthew Turk (2008), Scholarpedia, 3(9):4244. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/eigenfaces-tutorial/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>White Man&#8217;s Blues</title>
		<link>http://blog.zabarauskas.com/white-mans-blues/</link>
		<comments>http://blog.zabarauskas.com/white-mans-blues/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 14:45:03 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[blues]]></category>
		<category><![CDATA[guitar]]></category>
		<category><![CDATA[scholarship]]></category>
		<category><![CDATA[university of edinburgh]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=268</guid>
		<description><![CDATA[Due to the fact that I have found time to record these videos, I&#8217;m starting to suspect that my vacations have prolonged quite a bit&#8230; And I still have more than a week left.
A status update: apparently I have been awarded the Simon Gray prize by the Department of Philosophy at the University of Edinburgh. [...]]]></description>
			<content:encoded><![CDATA[<p><i>Due to the fact that I have found time to record these videos, I&#8217;m starting to suspect that my vacations have prolonged quite a bit&#8230; And I still have more than a week left.</i></p>
<p>A status update: apparently I have been awarded the <a href="http://www.scholarships.ed.ac.uk/presentstudents/hss/ppls.htm" target="_blank">Simon Gray prize</a> by the Department of Philosophy at the University of Edinburgh. That, a <a href="http://www.kal.com/" target="_blank">KAL</a> industrial scholarship, a couple of other prizes&#8230; I almost regret having to leave.</p>
<p>Anyway, here&#8217;s the video. Try to figure out which is worse: my playing or my webcam&#8217;s video quality.</p>
<div class="wp-caption alignleft" style="width: 340px"><br />
<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/kfjdGWzt_kc&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/kfjdGWzt_kc&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object><p class="wp-caption-text"> </p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/white-mans-blues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Elevator Music</title>
		<link>http://blog.zabarauskas.com/elevator-music/</link>
		<comments>http://blog.zabarauskas.com/elevator-music/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 20:28:36 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=264</guid>
		<description><![CDATA[Elevator music &#60;..&#62; refers to the gentle instrumental arrangements of popular music designed for playing in shopping malls, grocery stores, department stores, telephone systems (while the caller is on hold), cruise ships, airports, doctors&#8217; and dentists&#8217; offices, and elevators. [Wikipedia, http://en.wikipedia.org/wiki/Elevator_music]
]]></description>
			<content:encoded><![CDATA[<p>Elevator music &lt;..&gt; refers to the gentle instrumental arrangements of popular music designed for playing in shopping malls, grocery stores, department stores, telephone systems (while the caller is on hold), cruise ships, airports, doctors&#8217; and dentists&#8217; offices, and elevators. [Wikipedia, <a href="http://en.wikipedia.org/wiki/Elevator_music" target="_blank">http://en.wikipedia.org/wiki/Elevator_music</a>]</p>
<div class="wp-caption alignleft" style="width: 340px"><br />
<object width="320" height="265"><param name="movie" value="http://www.youtube.com/v/Wy2tLQnliQc&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Wy2tLQnliQc&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265"></embed></object><p class="wp-caption-text"> </p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/elevator-music/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edinburgh University, Computer Science and Artificial Intelligence, Semester II</title>
		<link>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-ii/</link>
		<comments>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-ii/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 12:47:21 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[data and analysis]]></category>
		<category><![CDATA[edinburgh university]]></category>
		<category><![CDATA[innovation and enterprise]]></category>
		<category><![CDATA[lectures]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[object-oriented programming]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=202</guid>
		<description><![CDATA[
As I have promised earlier, here&#8217;s the second part of my impressions about the individual courses in the first year of Computer Science and Artificial Intelligence at the University of Edinburgh. Hopefully you will find it useful, e.g. when choosing your outside courses, preparing for the exams or simply getting a taste of the CS [...]]]></description>
			<content:encoded><![CDATA[<p><small><div class="wp-caption alignleft" style="width: 177px"><img title="Labs @ Edinburgh University" src="http://blog.zabarauskas.com/img/infed.jpg" alt="Labs @ Edinburgh University" width="167" height="116" /><p class="wp-caption-text">Labs @ Edinburgh University</p></div></small></p>
<p>As I have promised <a href="http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-i">earlier</a>, here&#8217;s the second part of my impressions about the individual courses in the first year of Computer Science and Artificial Intelligence at the University of Edinburgh. Hopefully you will find it useful, e.g. when choosing your outside courses, preparing for the exams or simply getting a taste of the CS undergraduate life in the University of Edinburgh.</p>
<p>Once again, please bear in mind that all what is written below represents only my personal opinion.</p>
<p><strong>Innovation and Enterprise for Scientists and Engineers<br />
Professor: Khaled Benkrid</strong></p>
<p><strong>Lectures: </strong>a brilliant introduction to the main components and aspects of modern entrepreneurship, definitely one of the most interesting business courses that I’ve been to so far. Not only will you get the basic theoretic concepts of the modern business (like industry, marketing, operational, financial analyses, risk assessment), but you’ll also put them into practice while writing a business plan for your own idea, which will then account for 50% of your final grade.</p>
<p>What’s more, you’ll get the guest talks of local entrepreneurs (either spin-offs from the university, or related in some other way), an overview of the legal system regarding UK start-ups and businesses (PLCs, sole-traders, etc) and on top of that – it will all be related to the science and engineering (with Dr. Benkrid being a computer scientist himself!).<br />
All in all – a highly inspiring, exciting and recommended course!</p>
<p><strong>Exam: </strong>well… it all can’t be that interesting. <span id="more-202"></span>In the first half of the two hours closed-book exam you’ll have to prove that you’re capable of learning things by heart: you might be asked to list <a href="http://en.wikipedia.org/wiki/Porter_five_forces_analysis" target="_blank">Porter’s five competitive forces</a>, describe the four elements of any business model or give the five most common myths about entrepreneurs.</p>
<p>During the other hour, you’ll be given a much more reasonable task (in my humble opinion) to analyze and discuss a real-life business success/failure story from the various entrepreneurial aspects and answer a couple of more specific questions. To sum it up – even if you’re not very fond of learning things by heart, you’ll be all right if you’ll put some effort into your business plan. It won’t be easy to get a 100, but it surely is possible to still get an A (that&#8217;s what I got).</p>
<p><strong><br />
Data and Analysis<br />
Professor: Alex Simpson</strong></p>
<p><strong>Lectures:</strong> a fairly broad (and sadly/fortunately not that deep) grounding course on the data collection, representation and interpretation methods across different areas of Computer Science. Starting with the relational databases (E-R diagrams, <a href="http://en.wikipedia.org/wiki/Relational_algebra" target="_blank">relational algebra</a>, <a href="http://en.wikipedia.org/wiki/Tuple_relational_calculus" target="_blank">tuple-relational calculus</a>, SQL), XML (<a href="http://en.wikipedia.org/wiki/Document_Type_Definition" target="_blank">DTDs</a>, <a href="http://en.wikipedia.org/wiki/XPath" target="_blank">XPath</a>) and corpora (properties, annotation, tagging, querying using CQP), and finishing with information retrieval system topics (the vector space model, precision-recall tradeoff) and basic methods of statistical data analysis (<a href="http://en.wikipedia.org/wiki/Correlation" target="_blank">Pearson&#8217;s correlation coefficient</a>, <a href="http://en.wikipedia.org/wiki/Chi-square_test" target="_blank">Chi-square test</a>).</p>
<p><strong>Exams:</strong> quite surprisingly Dr. Simpson (being a brilliant mathematician himself, and hence supposedly a rational man) wants you to learn by heart a lot of things that you would typically look-up online. For the exam you will be supposed to know syntaxes of SQL and SQL DDL queries, XML document type definitions, XPath expressions and even the syntax of CQP queries for the <a href="http://www.ims.uni-stuttgart.de/projekte/CorpusWorkbench/HowToGet.html" target="_blank">CorpusWorkBench</a>.</p>
<p>Besides all that, during the exam you will probably need to design a database from a given scenario (and to draw an E-R diagram, to write SQL DDL statements and a couple of relational/TRC/SQL queries for it as well). You will also have to produce an XML document, together with a couple of XPath queries; do some evaluation for the given IR systems, discuss the necessary properties of corpora, find the correlation between the statistical data and check the hypothesis using the Chi-square test, so…  better do your tutorial exercises during the semester, ask a lot of questions in the lectures/tutorials and go through the past papers against the clock, because the exam is time-wise intense as well. It’s surely worth doing so, since the exam counts for the 100% of your grade (I managed to reach 97).</p>
<p><strong><br />
Object-Oriented Programming<br />
Professor: Ewan Klein</strong></p>
<p><strong>Lectures:</strong> not much to say here, actually. If you have done any Java programming before (and since you have applied to study Computer Science at one of the best IT departments in the whole world, chances are that you have) it’s going to be a breeze. Nothing sophisticated (<em>read: interesting</em>) here: methods, objects, inheritance, polymorphism, interfaces and abstract classes.</p>
<p>And I wouldn’t bother spending too much time doing the lab assignments (especially the optional ones): most likely you won’t be able to submit them to Web-CAT (the automatic grading system), or the Web-CAT won’t be able to compile, run or grade them. Oh, and they count for nothing to the final grade anyway. To be perfectly honest, they’re as useless, as the tutorials during which you should discuss your lab assignments, which <em>a)</em> you have done, and since they’re straightforward – there’s nothing more to discuss, or <em>b)</em> you haven’t done, and <em>i)</em> you have no clue what’s going on or <em>ii)</em> you’d like to learn how to do them, but what you haven’t realized is that learning to program by talking about it is as reasonable as learning to swim by reading the manual.</p>
<p><strong>Exam:</strong> two 20-minute tasks for which you will have two hours, one involving implementing a couple of simple methods with the arrays and the second involving implementing a list of classes from the given UML featuring some simple inheritance and polymorphism.</p>
<p>Maybe you shouldn’t read this, since I have had a reasonable amount of experience with Java before starting the course, but… if you have some experience with Java as well – most likely you won’t have to spend a single minute preparing for the exam, you’ll leave after the first half an hour and you’ll get a 100. At least, that’s what I did. And if you don’t have any experience, you’ll do fine as well.</p>
<p>My only advice to you then is – forget the lab assignments. Come up with the project that you always wanted to do – a simple adventure game or a text-based LAN chat application – and implement that in Java. You’ll get much more pleasure and benefit from it (and not only for the exam).</p>
<p><strong><br />
Mathematics for Informatics 2<br />
Professors: Martin Dindos, Antony Maciocia</strong></p>
<p><strong>Lectures: </strong>compared to the <a href="http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-i/#more-170" target="_blank">first semester</a> the maths will get more interesting (especially the calculus). You’ll delve into growth rates, complex numbers, power series, partial differentiation and first order differential equations; graph theory, recurrent relations, geometry in <strong>R</strong>² and <strong>R</strong>³, and end-up with matrices and Gaussian elimination.</p>
<p>However, due to the nature of the course itself, it&#8217;s broad, but not that deep. The lecturers will do a great job making all the material easy to grasp as well, but it surely doesn’t mean that you won’t have to make an effort to understand it, quite the opposite (it’s still mathematics, at the end of the day). The key thing to remember here (and I cannot overstress it) is <strong>DO</strong> the hand-in assignments! Not only will it help you to stay on top of the material, to formulate and ask the right questions during lectures and tutorials, but it will also account for the 15% of your final grade.</p>
<p><strong>Exams: </strong>a two and a half hours run through all the material. Just to scare you off a bit – in year &#8216;07/&#8217;08, 53% percent of all the students taking the course have failed this exam (after the re-sits).</p>
<p>Now, it was a lot easier when I took it (in &#8216;08/&#8217;09) – I don’t know the statistics, but I managed to get a 100, and I’m not brilliant at maths, so… draw your conclusions.</p>
<p>Anyway, there seem to be no guaranteed shortcuts in this course. The exams tend to be comprised mainly of the same type of exercises that you have done in your tutorials/hand-ins, and they’re focused more on the quantity than on the quality, so, if you managed to do those exercises – you should be on the right path.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>University of Cambridge, Wolfson College</title>
		<link>http://blog.zabarauskas.com/cambridge-university-wolfson-college/</link>
		<comments>http://blog.zabarauskas.com/cambridge-university-wolfson-college/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 11:52:57 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[cambridge university]]></category>
		<category><![CDATA[confirmation]]></category>
		<category><![CDATA[wolfson college]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=190</guid>
		<description><![CDATA[
So, it&#8217;s finally official. In less than two months time I&#8217;ll be reading Computer Science at the University of Cambridge, Wolfson College. Hopefully that&#8217;s the last university in my universities chain &#8211; all in all there are not many better places to go to. Not many at all.
I&#8217;m already looking forward to it. To the [...]]]></description>
			<content:encoded><![CDATA[<p><small><div class="wp-caption alignright" style="width: 111px"><img title="Wolfson College" src="http://profile.ak.fbcdn.net/object3/1946/69/n14811473732_2271.jpg" alt="Wolfson College" width="101" height="139" /><p class="wp-caption-text">Wolfson College</p></div></small><br />
So, it&#8217;s finally official. In less than two months time I&#8217;ll be reading Computer Science at the <a title="University of Cambridge" href="http://www.cam.ac.uk" target="_blank">University of Cambridge</a>, <a title="Wolfson College" href="http://www.wolfson.cam.ac.uk/" target="_blank">Wolfson College</a>. Hopefully that&#8217;s the last university in my universities chain &#8211; all in all there are not many better places to go to. Not many at all.</p>
<p>I&#8217;m already looking forward to it. To the legendary supervision sessions, to the world class experts in the field, to the competitiveness amongst the students. I&#8217;m sure I will finally arrive at the place where I&#8217;ll be the average guy between the best one&#8217;s&#8230; not the other way around.</p>
<p>(I&#8217;m not convinced that the latter applies to the basketball team, though. Well, I guess we&#8217;ll find that out pretty soon).</p>
<div class="wp-caption alignleft" style="width: 630px"><img title="Confirmation Letter. Cambridge University, Wolfson College, 2009." src="http://blog.zabarauskas.com/img/confirmation.jpg" alt="Confirmation Letter. Cambridge University, Wolfson College, 2009." width="620" height="424" /><p class="wp-caption-text">Confirmation Letter. Cambridge University, Wolfson College, 2009.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/cambridge-university-wolfson-college/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edinburgh University, Computer Science and Artificial Intelligence, Semester I</title>
		<link>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-i/</link>
		<comments>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-i/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 21:44:52 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[computation and logic]]></category>
		<category><![CDATA[edinburgh university]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[lectures]]></category>
		<category><![CDATA[logic]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=170</guid>
		<description><![CDATA[
Since the exam results came back and the first year is finally over, I have decided to share my impressions about the individual lectures in the first two semesters. Hopefully it will help someone to choose one subject over another, not to make the same mistakes when preparing for the exams that I did, or [...]]]></description>
			<content:encoded><![CDATA[<p><small><div class="wp-caption alignright" style="width: 217px"><a href="http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/competition/2008/Images/Manfredas_Zabarauskas.png"><img title="1 Night in Haskell" src="http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/competition/2008/Images/Manfredas_Zabarauskas.png" alt="1 Night in Haskell" width="207" height="162" /></a><p class="wp-caption-text">1 Night in Haskell</p></div></small></p>
<p>Since the exam results came back and the first year is finally over, I have decided to share my impressions about the individual lectures in the first two semesters. Hopefully it will help someone to choose one subject over another, not to make the same mistakes when preparing for the exams that I did, or simply to get the taste of the first year in college. Please bear in mind that all what is written below represents only my personal, highly subjective opinion.</p>
<p><strong><br />
Functional Programming<br />
Professor: Philip Wadler</strong></p>
<p><strong>Lectures:</strong> a wonderful introduction to the functional programming. Amazing teaching skills and professor&#8217;s authority in the classroom &#8211; from ripping a T-shirt to reveal a big superman-lambda, to being one of the principal engineers and designers of the <a href="http://en.wikipedia.org/wiki/Haskell">Haskell</a> programming language &#8211; 10 out of 10.</p>
<p><strong>Exam:</strong> Final grade is made by a programming class test (10%) and a final exam (90%). The programming class test is pretty straightforward &#8211; three simple tasks to test one&#8217;s basic knowledge of Haskell (things you need to know are the syntax, because it&#8217;s done on paper, list comprehension, recursion and simple library functions). The final exam is done in front of computer with plenty of time (2 hours) for three simple tasks (e.g. take a list of integers and return the sum of the cubes of the positive numbers in that list). The only catch is that the same problem has to be solved in a couple of different ways: using basic functions, using list comprehension, using recursion and using the higher-order functions, however&#8230; at the end of the day &#8211; it&#8217;s still the same problem.</p>
<p>My advice in succeding in this subject &#8211; <span id="more-170"></span>participate in the class&#8217; programming competition (see <a href="http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/competition/2008/competition.html">this years competition</a> and <a href="http://www.inf.ed.ac.uk/teaching/courses/inf1/fp/competition/2008/Images/Manfredas_Zabarauskas.png">my entry</a>). If you&#8217;ll manage to get something done &#8211; you won&#8217;t need to spend any more time to prepare for the final exam, and I can hardly imagine how you&#8217;d get less than an A (my personal result &#8211; 99).</p>
<p><strong><br />
Computation and Logic<br />
Professor: Dave Robertson</strong></p>
<p>Lectures: a basic introduction to reasoning &#8211; propositional logic, concepts of satisfiability, validity and proof, regular expressions, finite state transducers/acceptors, HMMs and probabilistic finite state machines. However, the professor seems to be a little distracted by his other responsibilities (being the Head of School of Informatics) so the lectures aren&#8217;t as involving as they could be. Be careful about the tutorial exercises as well &#8211; many of them contain mistakes, and some of the TA&#8217;s (master and PhD students) seem to have already forgotten the material quite a bit.</p>
<p><strong>Exam: </strong>a 2-hour rush through all of material &#8211; I remember writing eight A4 pages (that leaves 15 mins per page) on truth tables &#8211; inconsistencies, contingencies, tautologies, proving that formulas are equivalent, proof trees (including the negation rules), resolution &#8211; normal and clausal forms, transducer/acceptor FSMs, and their equivalence with regular expressions (Kleene&#8217;s Theorem); HMMs and probabilistic FSMs.</p>
<p>I&#8217;m afraid that there&#8217;s no easy way here &#8211; you just have to work your way through the bunch of tutorial exercises and past papers (I managed to drudge away to 89). The good thing is that exams don&#8217;t change too much and you will know what&#8217;s expected from you.</p>
<p><strong><br />
Mathematics for Informatics 1<br />
Professors: John Byatt-Smith, Antony Maciocia</strong></p>
<p><strong>Lectures:</strong> a semester-long review of a high school material trying to get everyone up to the same speed. It includes revision of real functions, integers, rationals, real numbers, number bases; differentiation: limits, tangent to a curve, stationary points, inverse functions; exponentials, logs, integral definition, integration methods and the Fundamental Theorem of Calculus; general algebra background: sets, functions, relations, mathematical induction; number theory: GCD, the extended Euclid&#8217;s algorithm, residues and equations, RSA; counting: permutations, binomial theorem, Pascal&#8217;s triangle; basic probability: discrete spaces, random variables, expectation, variance, Bernoulli trials, binomial and geometric distributions; entropy, Shannon&#8217;s source coding theorem and Huffman coding.</p>
<p>It may sound like a lot, but it&#8217;s more to the breadth than to the depth, really. Plus the lecturers will make all this material quite easy to grasp &#8211; just make sure to do your hand-in assignments (15% of the final grade) and do your fair share of the work in the tutorials (that includes asking the questions).</p>
<p><strong>Exam: </strong>two and a half hours of the hand-in assignment problems. If you&#8217;ve done those and went through a couple of the past years exams (you can find most of them <a href="http://www.lib.ed.ac.uk/resources/collections/exams.shtml">here</a>) you won&#8217;t have any trouble getting an A (my result &#8211; 96).</p>
<p><strong><br />
Logic 1<br />
Professor: Paul Schweizer</strong></p>
<p><strong>Lectures: </strong>with deep regret &#8211; incredibly boring. Professor Paul Schweizer doesn&#8217;t seem to be bothered too much about anything happening in the audience &#8211; noises, non-working microphones, or half of the students playing online poker. This is partially caused by Logic 1 being a compulsory course for many School of Philosophy, Psychology and Language Sciences students &#8211; and being way over their heads.</p>
<p>It&#8217;s extremely dissapointing because it could become a very good grounding course in logic (if anyone would pay at least some attention) &#8211; starting with the propositional logic and basic concepts, moving on to sematic tableaux, equivalence and adequacy, predicate logic, binary and identity relations and finally touching some of the theories of thruth and non-classical logic.</p>
<p><strong>Exam: </strong>another two hour rush through all the material &#8211; make sure to do as many of the previous year exams against the clock as you can!<br />
I&#8217;m afraid that there are no shortcuts here &#8211; you&#8217;ll have to work a lot on your own if you haven&#8217;t done any logic courses before (my result in the exam &#8211; 98. Yes, I have done logic courses before). Do as many exercises as you can find, ask your tutor the right questions and the golden rule &#8211; don&#8217;t leave anything unclear: look it up on the internet, ask your friends or the professor after the lecture. If you&#8217;ll attend the lecture. You probably won&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/edinburgh-university-computer-science-and-artificial-intelligence-semester-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMRP6400/SMDK64X0 IIC synchronization problems</title>
		<link>http://blog.zabarauskas.com/smrp6400smdk6410-iic-synchronization-problems/</link>
		<comments>http://blog.zabarauskas.com/smrp6400smdk6410-iic-synchronization-problems/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 21:45:12 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[iic]]></category>
		<category><![CDATA[samsung]]></category>
		<category><![CDATA[smdk6400]]></category>
		<category><![CDATA[smdk6410]]></category>
		<category><![CDATA[smrp6400]]></category>
		<category><![CDATA[windows ce]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=116</guid>
		<description><![CDATA[
Since last week we have spent quite some time debugging Samsung SMRP6400/SMDK64X0 IIC drivers, I thought I might share with one particular example here. It is both a good showcase of the hardware/software synchronization issues and since the bugs are in the latest version of the drivers shipped together with the development platforms, it might [...]]]></description>
			<content:encoded><![CDATA[<p><small><div class="wp-caption alignright" style="width: 191px"><img title="Debugging Samsung SMRP6400" src="http://blog.zabarauskas.com/img/100_0139_small.jpg" alt="Debugging Samsung SMRP6400" width="181" height="150" /><p class="wp-caption-text">Debugging Samsung SMRP6400</p></div></small></p>
<p>Since last week we have spent quite some time debugging Samsung SMRP6400/SMDK64X0 IIC drivers, I thought I might share with one particular example here. It is both a good showcase of the hardware/software synchronization issues and since the bugs are in the latest version of the drivers shipped together with the development platforms, it might save someone from additional headaches.</p>
<p>So, while working on the drivers for IIC one of our automated tests to make sure that IIC still works was to write some data on the bus, do an immediate read-back and verify that both data written and read back matches; something similar to this:</p>
<pre>UCHAR outData[3] = { REGISTER, DATA_BYTE_1, DATA_BYTE2 };
UCHAR inData[2] = { 0, 0 };

IIC_Write(SLAVE_ADDRESS, outData, 3);
IIC_Read(SLAVE_ADDRESS, REGISTER, inData, 2);

if ((inData[0] != DATA_BYTE_1) || (inData[1] != DATA_BYTE_2))
{
    DEBUGMSG(ERROR_MSG,
             (TEXT("Immediate write/read data mismatch: data sent [0x%X " \
                   "0x%X] differs from the data received [0x%X, 0x%X]."),
                   DATA_BYTE_1, DATA_BYTE_2, inData[0], inData[1]));
}</pre>
<p>However, after we added some IIC read calls from another hardware driver it started spitting fire throwing the following error message:</p>
<pre>Immediate write/read data mismatch: data sent <strong>[0xCA, 0xFE]</strong>
differs from the data received <strong>[0xCA, 0xFE]</strong>.</pre>
<p>Now this clearly meant we had a serious problem: the error message was saying that the data does not match, which obviously was not the case as shown by the message text!</p>
<p>Since we were pretty confident about our side of things, as well as the readings from the scope, it seemed like a good time to start looking at the Samsung IIC drivers (and especially s3c64X0_iic_lib.cpp). The driver structure there is pretty straightforward: the first read/write byte on the bus triggers the hardware IRQ, which is mapped to SysIntr triggering a transfer event; then any subsequent call to a read/write function blocks waiting for a <code>transfer-done</code> event, which is triggered when the last byte is read/written in the IST.</p>
<p>Everything looks sane up to the point where a <code>transfer-done</code> event is signalled from the IST (pseudocode, not the original code below, due to the legal issues):</p>
<pre>static HANDLE ghTransferEvent;
static HANDLE ghTransferDone;
static DWORD IICSysIntr;

...

static DWORD IST(LPVOID lpContext)
{
    BOOL bTransferDone = FALSE;

    while (TRUE) {
        WaitForSingleObject(ghTransferEvent, INFINITE);

        switch (IIC_BUS_STATUS) {
            case MASTER_RECEIVE:
                // receive bytes and store them in the buffer
            break;

            case MASTER_TRANSMIT:
                // transmit bytes from the buffer in memory
                if (LAST_BYTE) bTransferDone = TRUE;
            break;

            InterruptDone(IICSysIntr);

            if (bTransferDone) {
                SetEvent(ghTransferDone);
            }
        }
    }
}</pre>
<p>Two major problems with this code are:</p>
<ol>
<li>The <code>bTransferDone</code> variable is never set from the IIC read, and hence the <code>transfer-done</code> event for bus reads is never triggered,</li>
<li>After the <code>bTransferDone</code> is set from the IIC write, it is never reset, hence the <code>transfer-done</code> event is triggered after reading/writing single byte on the bus in all subsequent transactions.</li>
</ol>
<p>That explains the initial test case failure: during the write/immediate read data comparison the data arrives exactly between the <code>if</code> statement and the following printout, thus triggering the error message, but printing the correct data to the output due to the early signal of the event.</p>
<p>The way to solve this is also straightforward: make sure that the <code>bTransferDone</code> variable is cleared after the <code>transfer-done</code> event is triggered, and make sure that master-receive mode sets the <code>bTransferDone</code> variable after reading the last byte of the transaction from the IIC bus.</p>
<p>In pseudocode it would look similar to:</p>
<pre>static DWORD IST(LPVOID context)
{
    BOOL bTransferDone = FALSE;

    while (TRUE) {
        WaitForSingleObject(ghTransferEvent, INFINITE);

        switch (IIC_BUS_STATUS) {
            case MASTER_RECEIVE:
                // receive bytes and store them in the buffer
                if (LAST_BYTE) bTransferDone = TRUE;
            break;

            case MASTER_TRANSMIT:
                // transmit bytes from the buffer in memory
                if (LAST_BYTE) bTransferDone = TRUE;
            break;

            InterruptDone(IICSysIntr);

            if (bTransferDone) {
                bTransferDone = FALSE;
                SetEvent(ghTransferDone);
            }
        }
    }
}</pre>
<p>The lesson of the day (quoting my colleague) is: &#8220;<em>The first rule about multithreading &#8211; you&#8217;re wrong</em>&#8220;.</p>
<div class="wp-caption alignleft" style="width: 652px"><img title="At work. Wolfson Microelectronics PLC, 2009" src="http://blog.zabarauskas.com/img/100_0138_small.jpg" alt="At work. Wolfson Microelectronics PLC, 2009" width="642" height="496" /><p class="wp-caption-text">At work. Wolfson Microelectronics PLC, 2009</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/smrp6400smdk6410-iic-synchronization-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diversity Visa</title>
		<link>http://blog.zabarauskas.com/diversity-visa/</link>
		<comments>http://blog.zabarauskas.com/diversity-visa/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 21:36:22 +0000</pubDate>
		<dc:creator>Manfredas Zabarauskas</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[diversity visa]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[green card]]></category>
		<category><![CDATA[plans]]></category>
		<category><![CDATA[usa]]></category>

		<guid isPermaLink="false">http://blog.zabarauskas.com/?p=100</guid>
		<description><![CDATA[It all comes at once.
A couple of days ago I received a call from Lithuania &#8211; there was a letter from U.S. waiting for me at home. After some discussion it became clear that I was one of the 100 000 selected to compete for 55 000 DV&#8217;s (&#8221;Green Cards&#8221;).
After some short initial joy, problems [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 149px"><img title="Green Card" src="http://www.usborderlaw.com/images/green-card-holder.jpg" alt="Green Card" width="139" height="157" /><p class="wp-caption-text">&quot;Green Card&quot;</p></div>
<p>It all comes at once.</p>
<p>A couple of days ago I received a call from Lithuania &#8211; there was a letter from U.S. waiting for me at home. After some discussion it became clear that I was one of the 100 000 selected to compete for 55 000 <a title="Diversity Visa" href="http://en.wikipedia.org/wiki/Diversity_Visa" target="_blank">DV</a>&#8217;s (&#8221;Green Cards&#8221;).</p>
<p>After some short initial joy, problems and worries started to creep in: one has to cross the U.S. border in six months after getting a DV &#8211; something which I&#8217;m not keen doing at all, because I&#8217;ll be studying in Cambridge University at that time, and since I&#8217;ve worked quite hard to get there, it&#8217;s priority #1 in the list.</p>
<p>One possible solution would be to go to U.S. for the summer and then comeback for a school year, but&#8230; we&#8217;ll see how that goes, it might introduce some additional problems (about which I&#8217;m not fully aware at the moment). It would be nice to visit some old friends though&#8230;</p>
<p>Anyway, I&#8217;ll try to keep the whole process documented here as well &#8211; it might give someone a good estimate of trouble involved in getting a DV (and help me to track the overall progress as well).</p>
<p>Thanks for reading and stay tuned &#8211; there will be more.</p>
<div class="wp-caption alignleft" style="width: 572px"><img title="Boston, U.S.A. (09/2007)" src="http://blog.zabarauskas.com/img/PICT0553.jpg" alt="Boston, U.S.A. (09/2007)" width="562" height="750" /><p class="wp-caption-text">Boston, U.S.A. (09/2007)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.zabarauskas.com/diversity-visa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Code -->
