<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>k-Wave User Forum &#187; Topic: Creating my own HDF5 input file: calculation of ddx_k_shift_pos_r</title>
		<link>http://www.k-wave.org/forum/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r</link>
		<description>Support for the k-Wave MATLAB toolbox</description>
		<language>en-US</language>
		<pubDate>Tue, 12 May 2026 23:32:05 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.k-wave.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.k-wave.org/forum/rss/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r" rel="self" type="application/rss+xml" />

		<item>
			<title>Anthony on "Creating my own HDF5 input file: calculation of ddx_k_shift_pos_r"</title>
			<link>http://www.k-wave.org/forum/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r#post-3756</link>
			<pubDate>Wed, 26 Jun 2013 14:58:19 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3756@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi everyone,&#60;/p&#62;
&#60;p&#62;Just a little precision that might save some time if someone needs to do the same : as ddx_k_shift_pos_r (and its family) are complex values, you need to be careful when saving it with matlab into a HDF5 file.&#60;/p&#62;
&#60;p&#62;The sequence must be stored as :&#60;/p&#62;
&#60;p&#62;[real(ddx_k_shift_pos_r(1), imag(ddx_k_shift_pos_r(1),... ,real(ddx_k_shift_pos_r(Nx_r), imag(ddx_k_shift_pos_r(Nx_r)]. &#60;/p&#62;
&#60;p&#62;i.e. a vector of size 2*Nx_r.&#60;/p&#62;
&#60;p&#62;Anthony&#60;/p&#62;
&#60;p&#62;PS : another trick (not related to ddx_k_shift_pos_r), don't forget to scale the source terms as explained in &#34;kspaceFirstOrder_scaleSourceTerms.m&#34;.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Creating my own HDF5 input file: calculation of ddx_k_shift_pos_r"</title>
			<link>http://www.k-wave.org/forum/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r#post-3741</link>
			<pubDate>Fri, 21 Jun 2013 10:44:17 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3741@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Thanks for your explanation, &#60;/p&#62;
&#60;p&#62;it seems to work now!&#60;/p&#62;
&#60;p&#62;Anthony
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Bradley Treeby on "Creating my own HDF5 input file: calculation of ddx_k_shift_pos_r"</title>
			<link>http://www.k-wave.org/forum/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r#post-3736</link>
			<pubDate>Thu, 20 Jun 2013 22:33:58 +0000</pubDate>
			<dc:creator>Bradley Treeby</dc:creator>
			<guid isPermaLink="false">3736@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi Anthony,&#60;/p&#62;
&#60;p&#62;The formulae you mention are for when the staggered grid scheme is not used. This is an undocumented option that is only used for testing. The lines of code you need are directly above these, where&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;ddx_k_shift_pos = ifftshift( 1i*kgrid.kx_vec .* exp(1i*kgrid.kx_vec*kgrid.dx/2) );
ddx_k_shift_neg = ifftshift( 1i*kgrid.kx_vec .* exp(-1i*kgrid.kx_vec*kgrid.dx/2) );
...&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The difference between _neg and _pos is the direction of the spatial shift term (negative or positive). The _r suffix is used to show that only the first half of the Fourier data in the x-dimension is stored (see the _saveToDisk code for more details). This is because the FFT routine used in the C++ code is the real-to-complex FFT. This doesn't calculate the redundant part of the output for the FFT over the first dimension.&#60;/p&#62;
&#60;p&#62;Hope that helps!&#60;/p&#62;
&#60;p&#62;Brad.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Anthony on "Creating my own HDF5 input file: calculation of ddx_k_shift_pos_r"</title>
			<link>http://www.k-wave.org/forum/topic/creating-my-own-hdf5-input-file-calculation-of-ddx_k_shift_pos_r#post-3734</link>
			<pubDate>Thu, 20 Jun 2013 16:43:31 +0000</pubDate>
			<dc:creator>Anthony</dc:creator>
			<guid isPermaLink="false">3734@http://www.k-wave.org/forum/</guid>
			<description>&#60;p&#62;Hi everyone,&#60;/p&#62;
&#60;p&#62;I am currently trying to write my own HDF5 input file for the C++ code and I only have a problem with ddx_k_shift_pos_r and its family (ddx_k_shift_neg_r, ddy_k_shift_pos, ddy_k_shift_neg etc...).&#60;/p&#62;
&#60;p&#62;How to compute it? I have only found this formula in the matlab code (in kspaceFirstOrder3D.m):&#60;br /&#62;
ddy_k_shift_pos = ifftshift( 1i*kgrid.ky_vec );&#60;br /&#62;
ddy_k_shift_neg = ifftshift( 1i*kgrid.ky_vec );&#60;/p&#62;
&#60;p&#62;More precisely, I have 3 questions:&#60;br /&#62;
- it does not give the same result as when I read an input file created with kspaceFirstOrder_saveToDisk.m what makes me feel that my formula is not the right one, but I don't see anything else in the code...&#60;br /&#62;
- what is the difference between ..._neg and ..._pos?&#60;br /&#62;
- why is there a ..._r suffix along the x dimension? Is the formula different?&#60;/p&#62;
&#60;p&#62;Sorry for the question, but I have fought with this the whole afternoon.&#60;br /&#62;
Regards,&#60;br /&#62;
Anthony
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
