2013-01-01ãã1å¹´éã®è¨äºä¸è¦§
Vim Advent Calendar 2013 ã®24æ¥ç®ã®è¨äºã§ãã æ¨æ¥ã¯ @thincaããã® submode.vim ã§ç¹å®ã®æ¡ä»¶ã®æã ã submode ã«å ¥ãã§ããã ãã¦ä»æ¥ã¯ãæ¨æ¥æ å½è ã®thincaããä½ã® quickrun ã¨ããVimãã©ã°ã¤ã³ã®ã hook/eval/template ã¨ããæ©è½ãç´¹ä»ãã¾ãã â¦
ãªã¢ã¼ãã®ãã¼ã¿ããã¼ã«ã«ã«ãã¦ã³ãããæ義 å¤ãã®å ´åãªã¢ã¼ãã®ç°å¢ã¯è²§å¼±ã§ãããã¦è§£æãã¹ãè±å¯ãªãã¼ã¿ãç ã£ã¦ããã ä¸æ¹ãã¼ã«ã«ã®ç°å¢ã¯æå¼·ã ãã解æãã¹ããã¼ã¿ã¯ç¡ãã ãã®ãã¹ãããã解æ¶ããããã«ããªã¢ã¼ãã®æç¨ãªãã£ã¬ã¯ããªãâ¦
è¿½è¨ 2014/05/10 ãã®è¨äºã¯å¤ãã®ã§ã ã¯ã¦ãªããã°ã® LaTeX æ°å¼è¡¨ç¤ºãããã©ã«ã㧠MathJax åããã ãåç §ãã¦ãã ããã MathJaxãå°å ¥ããããã¯ã¦ãªããã°ãMarkdown+LaTeXã¨ãã夢ã®æ§ãªç°å¢ã«ãªã£ã¦ä¾¿å©ã¨ãã話ã ã¯ã¦ãªè¨æ³ã§æ°å¼ãæ¸ã 以åã¯â¦
æ°å¤è§£æã®ææ¥ã§éè¡åã¯æ±ãã¡ããã¡ã£ã¦è¨ããããã©ãæ°ã«ããªãæ°ã«ããªãã å®è¡åã®éè¡åãæ±ãã Fortranã® DGETRF ã§LUå解ããå¾ã DGETRI ã§éè¡åãæ±ããã /* * hoge.c * SIZE*SIZEåã®å®è¡åã®éè¡åãè¨ç® * å ã®è¡å㯠* (2 3 ) * (1 0.5)â¦
æ£å¼ãªaptãªãã¸ããªã®Vimã¯Ver7.3ã§æ®å¿µãªæãã ãã©ãã¡ãã£ã¨é å¼µãã°Ver7.4ãå ¥ãããã¨ãã§ããã $ sudo add-apt-repository ppa:fcwu-tw/ppa $ sudo apt-get update $ sudo apt-get install vim ããã§ã¤ã³ã¹ãã¼ã«ã§ãããç°¡åã ã£ãããã¼ã¸ã§ã³ã®â¦
VMware Player ã«ã²ã¹ãOSã¨ã㦠Linux Mint ãå ¥ãã¦ãããã« VMware Tools ãã¤ã³ã¹ãã¼ã«ããã¨ãã話ã VMware Toolsãå ¥ããã°ãä»®æ³ç°å¢Windowãå ¨ç»é¢ã«ã§ããããã¯ãªãããã¼ãã ãã¹ãOSã¨ã¤ã±ã¤ã±ã«ãªããããã£ã¬ã¯ããªãå ±æã§ããããããªãâ¦
ãã£ã¹ãã¬ã¤ã«ã°ã©ãã表示ããã pythonããgnuplotã使ãä¸ã§ããããæãç°¡åãªæ¹æ³ã from subprocess import call call( ["gnuplot", "-e", "plot sin(x); pause -1"]) qãæ¼ãã°ã°ã©ãã¯æ¶ããã ã°ã©ãããã¡ã¤ã«ã«ä¿å gnuplotã®è¨å®ã¯é·ããªãã®ã§â¦
ç°å¢å¤æ°ã®åå¾ # Python import os home = os.environ.get('HOME', "") ã«ã¬ã³ããã£ã¬ã¯ããªã®ãã¹ãåå¾ # Bash ... ãã¨ã㨠$PWDã«å ¥ã£ã¦ããã current_path=`pwd` # Python import os current_path = os.getcwd() # ã¹ã¯ãªããã®ãããã£ã¬ã¯ããªã®çµ¶â¦
Python3ã§ã¯ '%d'ã¨ã'%+5.3lf'ã®ãããªè¨æ³ã¯æ¨å¥¨ããããå»æ¢ãããã 代ããã«format()ã使ãå¿ è¦ãããã ãã®ãããªå¤æ´ããªãããçç±ã«ã¤ãã¦ã¯ã Python 3.0 Hacks第6å Pythonicãªæååãã©ã¼ãããforamat()ã¡ã½ãã ãåãããããã é«å°ãªçç±â¦
pythonã§ä¸¦åè¨ç®ããããã¨ããPoolã¨mapã使ãã®ãç°¡åã ã£ãã Cè¨èªã§ä¸¦åè¨ç®ãã¦é åã«æ ¼ç´ãã ã®ã¨åããããªæè¦ã mapã使ãã®ãã«ãã³ã¤ã¤ãHaskellã¿ããã ç°¡åãªä¾ twiceFuncã¨ããåã®é¢æ° f(x) = 2x ã« argList = [1,2,3] ã®åè¦ç´ ã並åã«â¦
注æç¹ forã«ã¼ãã並ååãã¦é åã«å¤ãä»£å ¥ãããã forã«ã¼ããä¸éã®æã¯ç°¡åã ãã©ã å¤éforã«ã¼ãã®å ´åã«ã¯ å å´ãã #pragma omp parralel forããªãã¨ãã°ãã 以ä¸ã®æ£è§£ã¨ã¾ã¡ãããè¦ãã°ããããããã æ£è§£ // å å¤å ±ã« #pragma omp ãã intâ¦
Linux Mintã«ã¯ã¤ã³ã¹ãã¼ã«æã«7zrã¨ããã³ãã³ããå ¥ã£ã¦ã¦ã ããã©ã«ãã§7zå½¢å¼ã®å§ç¸®ã¨è§£åãè¡ããã tar.gzã¨ã使ã£ã¦ãå ´åãããªãã å§ç¸® ãã£ã¬ã¯ããªãå§ç¸®ãã¦hoge.7zã«ããããæ®éã®æ¹æ³ã¯ $ 7zr a hoge.7z å§ç¸®ããããã£ã¬ã¯ããªå ãµã¤ãºâ¦
ãã®è¨äºã¯Pyclewnã®ã¤ã³ã¹ãã¼ã«è¨äºã§ãã Windowsã¸ã®ã¤ã³ã¹ãã¼ã«ã¯è²ã é£ããã¦æ念ããã以åã®ãã¼ã¸ã§ã³ã¯ç°¡åã«ã¤ã³ã¹ãã¼ã«ã§ããã¿ããã ãã©ãæè¿ã¯ãã¾ããããªãããªã®ã§LinuxMintã«å°å ¥ããã VimShellã§iexe gdbããã®ããããã©ãbreakpoiâ¦
æ®éã®(並åè¨ç®ã§ãªã)ããã°ã©ã ã§ä¹±æ°ã使ç¨ããéã«ã ããã°ã©ã ãå®è¡ãããã³ã«ç°ãªãç³»åã§æ¬ä¼¼ä¹±æ°ãçºçãããã«ã¯ seed ã«ç¾å¨æå»ã使ç¨ããã®ãä¸è¬çã ã è¦ããã« srand((unsigned) time(NULL)); ã¨ããã°ããã詳細ã¯ä»¥ä¸ã®ãã¼ã¸ã«ã¾ã¨ã¾ã£â¦
åå ã¨ã»ã¨ãã©åãã ãã©ãåå¿é²ã¨ãã¦ã ããããã㨠ããã»ã¹æ° allrank ã 4 ã¨ãã¦ã å myrank ã®é å my_array[3] myrank == 0 ... my_array[3] = {0,4,8}; // ååã¯{0,1,2}ã ã£ã myrank == 1 ... my_array[3] = {1,5,9}; // ååã¯{3,4,5}ã ã£â¦
ããããã㨠ããã»ã¹æ° allrank ã 4 ã¨ãã¦ã å myrank ã®é å my_array[3] myrank == 0 ... my_array[3] = {0,1,2}; myrank == 1 ... my_array[3] = {3,4,5}; myrank == 2 ... my_array[3] = {6,7,8}; myrank == 3 ... my_array[3] = {9,10,11}; ãã¾ã¨â¦
ã¤ã³ã¹ãã¼ã« Linux(Ubuntu)ã¸ã®å°å ¥ ã¤ã³ã¹ãã¼ã« $ sudo apt-get install libfftw3-3 libfftw3-dev libfftw3-doc ã³ã³ãã¤ã«æ¹æ³ $ gcc hoge.c -lm -lfftw3 Windowsã¸ã®å°å ¥ fftwã®windowsçã¤ã³ã¹ãã¼ã©ã®ãã¼ã¸ãã 32-bit version: fftw-3.3.3-dll32.ziâ¦
次ã®è¨äº-OpenMPIã®ä½¿ãæ¹ã«ã¤ã㦠OpenMPIã¨OpenMPã¯å¥ç©ã ãï¼ï¼ï¼ ã©ã¡ãã並åå¦çã®ããã®ãã¬ã¼ã ã¯ã¼ã¯ã ãã©ã ãªãã§ããããæ··ä¹±ãæãååãã¤ããã®ããã 両è ã®éã㯠ãMPIã§ã¯åããã»ã¹ãå æã®ã¡ã¢ãªé åãæ±ãã®ã«å¯¾ãã OpenMPã§ã¯ã¡ã¢â¦
\subsectionãå1,å2 ã«ãªãã \subsubsectionã(1),(2) ã«ãªãã å2ã®3çªç®ã®å¼ã«ã¯ (2.3) ã®ãããªã¿ã°ãä»ãã ç»åã®æ¿å ¥æ¹æ³ã«ã¯è²ã å®æ´¾ãããã¿ãããªã®ã§ãä»åã¯ããã¦è¨å®ããªãã£ãã æ¬åãå¦ç証çªå·ã¯ã¿ã¤ãã«ã®ä¸ã§ \flushright çã®ç°å¢ãâ¦
Windows(minGW), Mac, Linux ã®gcc(version 4.2以é)ã§åä½ç¢ºèªæ¸ã æ°ããã©ã¤ãã©ãªçãã¤ã³ã¹ãã¼ã«ãããã¨ãªããããã©ã«ãã®ã¾ã¾ã®gccã§ã³ã³ãã¤ã«ãéã£ãã ãããªã«æ軽ã«ä¸¦åè¨ç®ã§ãããªãã¦ãããã ã½ã¼ã¹ã³ã¼ã // hoge.c // 並åå¦çã®ããã°â¦
Osakaãã©ã³ãã®ã¤ã³ã¹ãã¼ã«æ¹æ³ ã¾ãWindowsã§Osakaãã©ã³ãã使ããï¼ã«ç½®ãã¦ããOsaka.zipããã¦ã³ãã¼ããã¦è§£åãããOsaka.ttcãå¾ãããã Windows æ®éã« Osaka.ttc ãããã«ã¯ãªãã¯ãã¦ã¤ã³ã¹ãã¼ã«ãã Mac OSX æ®éã« Osaka.ttc ãããã«ã¯ãªâ¦
fooupdatebar.exeãªããã¡ã¤ã«ãä½ã£ã¦ã¯ãªãã¯ããã¨æãããã ãã®ããã§ãã°ãåããªãã£ããWindows ã¯ã´ã
ã·ã§ã«ã¹ã¯ãªããããæ°å¤è¨ç®ããã°ã©ã ãèµ°ããã¦ã çµæã Gnuplot ãããããªå ´åã«ã ãããã表示ç¨ã® Gnuplot ã¹ã¯ãªãããå¥ãã¡ã¤ã«ã«æºåããã®ãé¢åãããã ãã¹ã¦ã®å¦çãåä¸ã®ã·ã§ã«ã¹ã¯ãªãããã¡ã¤ã«ã§æ¸ã¾ãã¦ãã¾ãããããããªæã®ããâ¦
ããªã¼ãªæ°å¼å¦çã½ãã Maxima ã使ç¨ã㦠ããã¼ãã½ã³ã»ã¦ã©ã¼ã«ã¼è¨é ããã¢ã¤ã³ã·ã¥ã¿ã¤ã³ãã³ã½ã«ãè¨ç®ããã¡ã¢ã è åã§å¼å¤å½¢ããã®ã¯å¤§å¤ãããã ã¾ãæåã« ctensor ã load ã㦠csetup() ããè¨éãä½ãã (%i1) load(ctensor); (%o1) C:/PROâ¦
é£ãã å°é£ ããããã ããã使ãåãã«ã¤ãã¦ãåã¨ä¸éã¨ã®ããã ã«é½é½¬ããã(ãããªæ°ããã)ã ãã®éãã«ã¤ãã¦èª¬æããä¸éãæè²ãã¦ãããã é£ãã è³å³åãé·æéãã£ãã使ã£ã¦ã質ã®è¯ãä½ããåµä½ããæãã ä¾) å²ç¢ã®ããã«æ´ç¶ã¨ãã¦å®æâ¦
Gnuplot ã«ã¯ xtics ãã nokey ãããã°ã©ãã®ã¿ã¤ãã«ããä½ç½®ã®å¤æ´ããã ã¨ã«ããã°ã©ãã®è¡¨ç¤ºã«é¢ããããã¨ãããããªãã·ã§ã³ãçµã¿è¾¼ã¾ãã¦ãããã®ã®ã è¦ããã®ã調ã¹ãã®ãé¢åèãããé å¼µã£ã¦ãªãã·ã§ã³ãè¨å®ãã¦ã æãéãã«ãããªãå ´åãâ¦
Windowsã«ã¯ IrfanView ã¨ãã使ããããç»åãã¥ã¼ã¢ãããã 大æµã©ããªç»åã§ãéãããã®ã®ãLaTeX ãªã©ã§ä½¿ç¨ãã eps ç»å㯠ããã©ã«ãã§ã®ã¾ã¾ã ã¨éããªãããªãã·ã§ã³ã§ gsdll32.dll ãæå®ããã°éããããã«ãªãã以ä¸ã¯ãã®å ·ä½çãªèª¬æã ããâ¦
ãã³ãå³ ãªãããæãéã«ã ããã¤ãã®ã°ã©ãã横ã«ä¸¦ã¹ã¦æç»ããããªãã ãããã¯æ°ç¨®é¡ã®éãæ¯è¼ãããªãã縦ã«ä¸¦ã¹ãããªãã ããã ããããæã«ã¯ Gnuplotã®ã³ãã³ã set multiplot ã使ç¨ãã¦è¤æ°æã®ã°ã©ãã並ã¹ãã°è¯ãã®ã ãã ããã¤ãããâ¦
Vim Advent Calendar ã®165æ¥ç®ã®è¨äºã§ãã ååã®è¨äºã¯thincaããã®åä¸è¦ããããã¼ã«æ³¨æã§ããã Vimã®è¨å®ãã¡ã¤ã«ãGitHubçã®ãªã¢ã¼ããªãã¸ããªã§ç®¡çããã°ãæ°ããç°å¢ã«Vimãã¤ã³ã¹ãã¼ã«ããéæéãçãã¾ãã 便å©ãªåé¢ããªã¢ã¼ãã§ç®¡çã§â¦
ãã¾ã«æ°ããç°å¢ãä½ãã¨ãããã¤ãå¿ãã¦ã°ã°ããã¡ã«ãªãã®ã§ã¡ã¢ã ãã¡ãã¡ã«ãããã©ãããããã æ¢ã«è¯è³ªã®è§£èª¬ãããããããã®ã§ãURLãè²¼ã£ã¦ã¾ã¨ãã¦ãããã ãã©ã³ãã®è¨å®ã®æé Gvimãç«ã¡ããã¦ãã³ãã³ãã¢ã¼ã㧠set guifont=* ãã¦ãã©â¦