<br><br>On Thursday, August 30, 2012, Neal Becker  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think this should be simple, but I'm drawing a blank<br>

<br>
I have 2 2d matrixes<br>
<br>
Matrix A has indexes (i, symbol)<br>
Matrix B has indexes (state, symbol)<br>
<br>
I combined them into a 3d matrix:<br>
<br>
C = A[:,newaxis,:] + B[newaxis,:,:]<br>
where C has indexes (i, state, symbol)<br>
<br>
That works fine.<br>
<br>
Now suppose I want to omit B (for debug), like:<br>
<br>
C = A[:,newaxis,:]<br>
<br>
In other words, all I want is to add a dimension into A and force it to<br>
broadcast along that axis.  How do I do that?<br>
<br></blockquote><div><br></div>np.tile would help you there, I think.<br><br><div><br></div><div>Ben Root<span></span></div><div></div>