Thursday, December 19, 2013

numpy dot vs inner

dot and inner returns the same result for 1D arrays.
However, for 2D arrays (matrices), dot gives the matrix product, whereas inner gives the sum-product over the last axis.

References
inner vs. dot
inner document
dot document

what is sum product?
A = [[x1, x2], [x3, x4]]
B = [[y1, y2], [y3, y4]]

sum product of A and B is given by numpy.inner(A,B) as follows
A's row i is element-wise multiplied by B's row j and the values are added to get the (i,j) element

[[x1*y1+x2*y2, x1*y3+x2*y4], [x3*y1+x4*y2, x3*y3+x4*y4]]

Saturday, April 20, 2013

Apple airplay no sound issue

Sometimes when you mirror your display on airplay you cannot hear. Do the following to solve this issue.

sudo killall coreaudiod

Thursday, February 28, 2013

tmux

  • Commands:
    • starting a new named session
      • $ tmux new -s session_name
  • you can use a .tmux.conf file in your home directory to tmux as follows
    • setw -g mode-mouse on
    • # scrollback buffer size increase
    • set -g history-limit 500000
  • note that with mode-mouse on you cannot copy paste text (you can scroll). You need to do the following Ctrl+B: (note the colon) and then enter the following command
    set -g mode-mouse off
  • when you have finished copy/pasting text you can turn mode-mouse to on so that you can scroll using the mouse wheel

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1