zshã®å³ããã³ããã«ã³ãã³ãéå§çµäºæå»ã表示
ã³ãã³ãã®éå§æå»ã¨çµäºæå»ãå³ããã³ããã«è¡¨ç¤ºããããªã£ãã
$ 15:00:00 - # 15æ00å00ç§ã« sleep 30 ãå ¥åéå§ $ sleep 30 15:00:00 - # 10ç§æã㦠sleep 30 ã¨æã¡è¾¼ãã $ sleep 30 15:00:00 - 15:00:10 # 15æ00å10ç§ã«ã¨ã³ã¿ã¼ãã¼æ¼ãã # 30ç§çµé $ 15:00:40 - # 15æ00å40ç§ã«ã³ãã³ãçµäº
ãããå®ç¾ããã«ã¯ã以ä¸ã®ã³ã¼ãã ~/.zshrc
ã«æ¸ãè¾¼ãã°å®ç¾ã§ãããã ãã¶è©¦è¡é¯èª¤ããã
export PREV_COMMAND_END_TIME export NEXT_COMMAND_BGN_TIME function show_command_end_time() { PREV_COMMAND_END_TIME=`date "+%H:%M:%S"` RPROMPT="${PREV_COMMAND_END_TIME} - " } autoload -Uz add-zsh-hook add-zsh-hook precmd show_command_end_time show_command_begin_time() { NEXT_COMMAND_BGN_TIME=`date "+%H:%M:%S"` RPROMPT="${PREV_COMMAND_END_TIME} - ${NEXT_COMMAND_BGN_TIME}" zle .accept-line zle .reset-prompt } zle -N accept-line show_command_begin_time
ã°ã°ã£ããä¼¼ããããªè¨å®ãã¦ã人ãå½å å¤ã«æ£è¦ãããã®ã ãã éå§æå»ã¨çµäºæå»ã®ä¸¡æ¹ãUPDATEãã¦ããä¾ãè¦ã¤ãããªãã£ãã ããã¨ä¾¿å©ã ã¨æãã使ãã¨ãããï½
ä¸çã®ã¤ã³ã¯ç¶ã®å½¢ç¶ã¾ã¨ã
ä»é±ã®åæ¥ã¯å®¶ã«å¼ãããããä¸çåå½ã®ã¤ã³ã¯ç¶ã®å½¢ç¶ã調ã¹ã¦ããã ä¸ã®ãã¼ãã«ã§ãæ¥æ¬ããã¢ã¡ãªã«ã¾ã§ã®åå½ã®éé»ç³»ã¤ã³ã¯ç¶ã®å½¢ç¶ãã¾ã¨ãã¦ãããã
åå½ã®ç¹å¾´ãã¾ã¨ããã¨ã
- æ¥æ¬ … 丸ãå°å½¢ãªã©ã·ã³ãã«ãªå½¢ç¶ãå¤ããå°å½¢(ãã©ãã30mlããã¤ããã30ml)ã®ç¶ã¯å¤å½ã ã¨çãã?
- ãã¤ã … æ£é¢ã®å½¢ç¶ãæå½¢ã®ä¸é¨ãªã®ãå¤ã
- ã¹ã¤ã¹ … æªãã§ãã
- ã¤ã¿ãªã¢ … ãã¤ãã¨åããæåã«ãããå¤ããå¤é¢ä½ãããã¶ã¤ã³ã®åã£ãç¶ãå¤ã
- ãã©ã³ã¹ … è§ã°ã£ã¦ãã
- ã¤ã®ãªã¹ … ç´æ¹ä½ã®ã¨ãã¸ãã¾ãããå°è±¡
- ã¢ã¡ãªã« … ç¹å¾´ãç¡ãã®ãç¹å¾´?
ãã¾ããã£ãã調ã¹ã¦ãªããã©ãå½æ¯ã«ç¹å¾´ããã£ã¦é¢ç½ããï½
æ¥ | ãã¤ããã | ã»ã¼ã©ã¼ | ãã©ãã |
ç¬ | Montblanc | Pelikan | LAMY |
ç¬ | STAEDTLER | KAWECO | ABER-CASTELL |
ç | Caran dâAche | ||
ä¼ | AURORA | DELTA | MARLEN |
ä¼ | VISCONTI | OMAS | DIAMANTE |
ä» | WATERMAN | S.T. Dupont | J. Herbin |
è± | PARKER | DIAMINE | |
ç±³ | CROSS | SHEAFFER | MONTEVERDE |
ä¸å¹´çç¨ã®PILOT製70mLã¤ã³ã¯ç¶ã«é¢ããçºè¦
åã¯ä»ã¾ã§8å¹´éãæ¯æ¥PILOTã®ä¸å¹´ç CUSTOM743 ã§ãã¼ããåãã70mLã®BBã¤ã³ã¯ç¶ã使ãç¶ãã¦ããã®ã ããä»æ¥é大ãªäºå®ãçºè¦ããã
çºè¦ãããã¨
CUSTOM743 ã®é¦è»¸ãã 70mLã¤ã³ã¯ç¶ã®å¥¥ã®å¥¥ã¾ã§ããæ¿ãã¦ãããã³å ãç¶åºã«å°éããªããã¨ãçºè¦ããã
ä¸å¹´çã®é¦è»¸ããé¦è»¸åãã®ãã©ã¹ããã¯å®¹å¨ã«çªã£è¾¼ãã æ§åããã®ãã©ã¹ããã¯å®¹å¨ã¯æ®æ®µã¤ã³ã¯ç¶ã®ä¸ã«æ²ãã§ããã | ãã³å ã¯å®¹å¨ã®åºã«å±ãã¦ããªãï¼ |
ãããã§ã¤ã³ã¯å¸å ¥ãççã«æãããã«ãªã£ãã
å¸å ¥ã¹ã¿ã¤ã«
ä»ã¾ã§ã¯ãç¶åºã«ãã³å ãæ¥è§¦ããªããããã³ãä¸ç©ºã«æµ®ããã¤ã¤å¸å ¥ãã¦ããã ãã®ããç¶ç¸ã«æãæãã¦ãã³ãåºå®ãã¤ã¤ãã³ã³ãã¼ã¿ã®åºããã¿ã³ãæ¼ãã¦ããã®ã ããããã¯æãã¤ãããã«ãªãã å¤ã«åãå ¥ã£ã¦ç¶ã転åãããã«ãªãããæã¯ã¤ã³ã¯ã§æ±ãããããã³å ãç¶åºã«æ¼ãä»ãã¦å£ãã¦ãã¾ãä¸å®ããã£ãã
ããããå®ã¯ç¶ã®è¨è¨ä¸ããã³å ãç¶åºã«å±ããã¨ã¯ãªãã£ãã®ã ã ä»å¾ã¯å¥¥ã¾ã§æãã£ããããæ¿ãã¦ãå ¨åã§ãã¿ã³é£æãã¦ããæåã ã©ãã ã奥ã¾ã§åºãã¦ãããã³å ãæ½°ãããã¨ã¯ãªãã®ã ã
ä»ã¾ã§ã®ã¤ã³ã¯å¸å ¥ãè¬æãç¶ç¸ã«æãã¦ãã³ãä¸ç©ºã«æµ®ããã¦ããã | ä»å¾ã®ã¤ã³ã¯å¸å ¥ãå ¨åã§æ¼ãä»ãã¦ããã |
è足
ãªããã£ã¨æ©ãæ°ä»ããªãã£ãã®ãããã ãã¤ãããã¯ãã£ã¨ç©æ¥µçã«ããã³å ã¯åºã«å½ãããªãããã¨å§ä¼ãã¦ã»ããã§ããã CUSTOM743ã®ããã¯823ã¨ååã§ããªããã«ããã ä»ã®ä¸å¹´çã§ããã³å ã¯ç¶åºã«å±ããªãã ãããå¤åã
ãã¨(ããã¯æåã ã)ã70mLã¤ã³ã¯ç¶ã¯ç¶ãéãã«ããã¨å ¥ãããããªãã
PILOTã®ç´°åä¸å¹´çã¯è¶ å質ããããBBã¤ã³ã¯ã¯ããã¼æé«ã ããèæ°´æ§ãããããããããç¶ã®æ§é ãæé«ã ããä»å¾ã使ãç¶ãããã¨æãã ãã¨ããã°ç¨ã«åçæ®ã£ã¦ã¦æ°ã¥ãããã©ãç¶ã®å½¢ãããã¡ã«æªãã§ããªã
LaTeXã§jpgæ¿å ¥æã«æ¡å¼µåã大æåã ã¨ããã
Windows7ã®C:/w32tex/…ã«ã¤ã³ã¹ãã¼ã«ããplatex+dvipdfmxã使ã£ã¦ããã¨ãã jpgã ã¨ã»ã¼ãã§JPGã ã¨ã¢ã¦ãã ã£ããåé¡è§£æ±ºã«ä¸æéãããããã£ããã
\documentclass[12pt,a4paper]{jreport} \usepackage[dvipdfmx]{graphicx} \begin{document} % ã»ã¼ããèªåã§a.xbbãä½æããã \begin{figure}[] \includegraphics[]{a.jpg} \end{figure} % ã»ã¼ããèªåã§dir/b.xbbãä½æããã \begin{figure}[] \includegraphics[]{dir/b.jpg} \end{figure} % ã¢ã¦ããèªåã§dir/c.xbbãä½æãããªã % èªå㧠extractbb c.JPG ããã ebb c.JPG ãã¦ãèªã¿è¾¼ã¾ããªãã絶æ \begin{figure}[] \includegraphics[]{dir/c.JPG} \end{figure} \end{document}
Makefileææ³ãããã
èªåç¨ã®ã¡ã¢ã¨ãã¦ãMakefileã®ææ³ã§å¿ããã¡ãªé¨åãã¾ã¨ãã¦ããã
æ³å®ãã¦ãã®ã¯ GNU make 4.2.1 ã§ãLinux ã Mac OS X ã§æ®éã« make ã³ãã³ããå©ããã¨ãã«èµ°ããã¤ã ã FreeBSD ã Solaris ã§ã¯ gmake ã³ãã³ããããã Windowsã§ã¯ http://gnuwin32.sourceforge.net/packages/make.htm ããã¤ã³ã¹ãã¼ã«ã§ããã
以ä¸ã§ã¯å ·ä½ä¾ã¨ãã¦
$ gcc src/main.c -o obj/main.o $ gcc src/A.c -o obj/A.o $ gcc obj/main.o obj/A.o -o exec.out
ãèªååããããã®Makefileãèããã
ææ³ãããã
CC := gcc ALL_C := $(wildcard src/*.c) # src/main.c src/A.c ALL_O := $(patsubst src/%.c,obj/%.o,$(ALL_C)) # obj/main.o obj/A.o exec.out: $(ALL_O) # ä¸çªæåã«è¨å®ããä¾åé¢ä¿ã¯ãmake (å¼æ°ãªã)ã§å®è¡å¯ $(CC) $^ -o $@ %.o: %.c # ãã¿ã¼ã³ããããä»ã« A.o:... ãããã°ããã¡ããåªå $(CC) -c $< -o $@ .PHONY: clean # clean ã¨ãããã¡ã¤ã«ãåå¨ãã¦ããç¡è¦ã㦠make clean ã§ãã clean: @rm -rf *.out ./obj/*.o # @ãã¤ããã°ãçµæã表示ãããªã
ããã§ä½¿ã£ãææ³ãã¾ã¨ãã¦ãããã 以ä¸ã®11é ç®ãè¦ããã ãã§ãããªãé«åº¦ãªMakefileãä½ããããã«ãªããã ã¾ãã¯æååã®æ±ãã ã
HOGE := foo bar
ã§å®ç¾©ã$(HOGE)
ã§åç §- ãã¡ã¤ã«æ¤ç´¢ã¯
$(wildcard src/*.c)
- ç½®æã¯
$(patsubst a%b,c%d,aXXXb aYYYb)
—> cXXXd cYYYd
patsubstã¯åè§ã¹ãã¼ã¹ãæåã¨ã¿ãªãã®ã§ã$(patsubst A, B, C)
ã¿ããã«ç©ºç½ãå
¥ãã¦ã¯ãããªãã
次ã«ç¹æ®å¤æ°ã ã
$@
ã¯çæãã¡ã¤ã«ãã¢ãããã¼ã¯ã¯ arrive atã®atã¨åãé°å²æ°$<
ã¯ä¾åãã¡ã¤ã«ã®ãã¡ä¸çª <— å´ã«æ¸ããããã¤$^
ã¯ä¾åãã¡ã¤ã«å ¨ã¦ã^ã¯å·¦ç«¯ããå³ç«¯ã¾ã§ãã¤ã¾ã¿ä¸ããé°å²æ°%.o:...
ãããã°ãA.o
ãå¿ è¦ã¨ãªã£ãéã%ãAã«ç½®æãã¦å®è¡ããã
ä¾ãã°ç¹æ®å¤æ° $@
ã®æ¡å¼µå.oã.cã«ç½®æããå ´å㯠$(patsubst %.o,%.c,$@)
ã¨ããã
ãã®ã»ãã®æ³¨æç¹ã¯
.PHONY: clean
ãã¦ããã°ãcleanã¨ãããã¡ã¤ã«ãç¡è¦ããã@rm -rf
ã®ããã« @ ãã¤ããã°ãµã¤ã¬ã³ãã¢ã¼ãã«ãªã
ã¡ãªã¿ã«ä»åã¯åºç¾ããªãã£ããã©ãä»ã®ãã¡ã¤ã«ã¨é£æºããéã¯
- Makefile ãã sub/Makefile ã«æ¸ããã make hoge ãå®è¡ããã«ã¯
cd sub && $(MAKE) hoge "CC=$(CC)"
- å¤é¨ãã¡ã¤ã« hoge ãèªã¿è¾¼ãã«ã¯
-include hoge
ããããã¡ã¤ã«
ããã ãã ã¨ãããããã¡ã¤ã«ç¡ããããï¼ãã¨ããææãããã®ã§ãè¨äºãæ¸ãããåèã«ãã¦ããã auewe.hatenablog.com
ã©ãã§ããã話ã
Makefileã®æ¸ãæ¹ãè¦ããããªããç¿å¾ãã¦ãããªããããã«å¿ããã
Bitbucketã®èªåç¨ãªãã¸ããªã調ã¹ããã5å¹´éãããã¦25åã®Makefileãè¦ã¤ãã£ãã
æ®éããã ãæ¸ãã°ãèªåçã«ã¡ã¤ã¯ãã¹ã¿ã¼ã«ãªããã¯ããªã®ã«ããã¾ã ã«
ã$@
ã ã£ã%@
ã ã£ã?ã ãªã©ã¨æ©ãã ããç½®æãã¯ã¤ã«ãã«ã¼ãã®ä½¿ãæ¹ãã°ã°ã£ãããã¦ããã
åå ã¯ãMakefileã¯ææ³ããã¢ãããã«ä¸éå端ãªæ©è½ãä¸éå端ã«æã£ã¦ããããã ã¨æãã
ã¡ã¤ã¯ãã¹ã¿ã¼ã«ãªãããã«ã¯ãã¾ãæ±ç¨æ§ã®é«ã便å©ãªæ©è½ã ãããã£ããè¦ããã®ãéè¦ãªã®ã§ã¯ãªããã
éå»ã®èªåã¨æ±ºå¥ãã¹ããä»åããMakefileææ³ãããã ããã£ããæè¨ãããã¨æãï½
Makefileã§ã½ã¼ã¹ãããããã¡ã¤ã«ã®ä¾åé¢ä¿ãå¦ç
大è¦æ¨¡ãªCè¨èªããã°ã©ã ã§ã¯ãã½ã¼ã¹ãããããã¡ã¤ã«ãè¤éãªä¾åé¢ä¿ãæã¤ãããããããèªå解決ãã¦ãããMakefileã欲ãããªãã 欲æãå ·ä½åããã¨
- ã½ã¼ã¹ããããããªãã¸ã§ã¯ããã¡ã¤ã«ã¯ç°ãªããã£ã¬ã¯ããªã«å ¥ããã
- ä¾åé¢ä¿ãèªèããæ´æ°ãã¹ããªãã¸ã§ã¯ããã¡ã¤ã«ãèªåæ¤åº
- æ°ããã½ã¼ã¹ãããããã¡ã¤ã«ãä½æããéãMakefileãæ¸ãæãã«æ¸ã
- ä»ã®ããã¸ã§ã¯ãã«ã使ãã¾ãããæ±ç¨æ§
- Makefileèªä½ãçããä¿å®ãããã
ã ãã¶è´ æ²¢ã ããé å¼µã£ã¦Makefileããããããã®ã§ãå¾ãããç¥è¦ãå¿ããªããã¡ã«ã¾ã¨ãã¦ããã 以åæ¸ããMakefileææ³ãããã ãåèã«ãã¦ããã
ãã£ã¬ã¯ããªæ§æ
root +----src/ | +---- main.c # mA.h ãèªã¿è¾¼ã | +---- A.c # mA.h 㨠A.h ãèªã¿è¾¼ã | +----inc/ | +---- mA.h # ä¾åãªã | +---- A.h # B.h ãèªã¿è¾¼ã | +---- B.h # ä¾åãªã | +----obj/ | +---- main.o # makeã³ãã³ãã§ä½æããã | +---- A.o # makeã³ãã³ãã§ä½æããã | +---- Makefile # *.o ãä½æ | +---- exec.out # makeã³ãã³ãã§ä½æããã +---- Makefile # exec.out ãä½æ
*.c *.h *.o ã¯ããããå¥ãã£ã¬ã¯ããªã§ç®¡çããã ãã¡ããä¾åé¢ä¿ãèæ ®ãã¦
- A.c ãæ´æ°ãããã°ãA.o ãæ´æ°
- mA.h ãæ´æ°ãããã°ãmain.o 㨠A.o ãæ´æ°
- B.h ãæ´æ°ãããã°ãA.o ãæ´æ°
ã¨ãã£ãå ·åã§ãªãã¸ã§ã¯ããã¡ã¤ã«ãä½ãç´ããexec.out ã«åãªã³ã¯ãããã®ã ã
Makefile
ãã®ç¶æ³ã«å¯¾å¦ããã«ã¯ãã¾ã root/Makefile ãä½ã
# root/Makefile CC := gcc ALL_C := $(wildcard src/*.c) # src/main.c src/A.c ALL_O := $(patsubst src/%.c,obj/%.o,$(ALL_C)) # obj/main.o obj/A.o ALL_CH := $(wildcard src/*.c inc/*.h) # src/*.c inc/*.h exec.out: $(ALL_CH) cd obj && $(MAKE) "CC=$(CC)" # obj/Makefile ãå®è¡ãã (ALL_Oãä½æããã) $(CC) $(ALL_O) -o $@ .PHONY: clean clean: @rm -rf *.out obj/*.o obj/*.d
ãã®ãã¡ã¤ã«ã®å¦çå
容㯠Makefileææ³ãããã ãè¦ãã°ç解ã§ããã ããã
è¦ããã«ã½ã¼ã¹ãããããã¡ã¤ã«ã«æ´æ°ãããã° exec.out
ããªãã«ãããã®ã ãã
æ´æ°ãã¹ããªãã¸ã§ã¯ããã¡ã¤ã«ã®æ¤åºã¨åã³ã³ãã¤ã«ã¯ root/obj/Makefileã«ä¸¸æããã¦ããã
ãã® root/obj/Makefile ã¯
# root/obj/Makefile ALL_C := $(wildcard ../src/*.c) # ../src/main.c ../src/A.c ALL_O := $(patsubst ../src/%.c,%.o,$(ALL_C)) # main.o A.o ALL_D := $(patsubst ../src/%.c,%.d,$(ALL_C)) # main.d A.d ALL_H := $(wildcard ../inc/*.h) # ../inc/mA.h ../inc/A.h ../inc/B.h .PHONY: dummy # dummy ã¨ãããã¡ã¤ã«ã¯ä½æãããªãã®ã§ PHONY æå® dummy: $(ALL_O) # å®è¡ããã«ã¯ ALL_O ãå¿ è¦ --> ä¸ã® %.o:... ã§ä½æ %.o: ../src/%.c # A.c 以å¤ã®ä¾åãã¡ã¤ã«ã¯ãä¸ã® -include A.d ã§è¨å®ããã $(CC) -c $< -o $@ %.d: ../src/%.c $(ALL_H) # ä¸ã® -include å½ä»¤ããå¼ã°ãã cpp -MM $< -MF $@ # A.c ã®ä¾åé¢ä¿ãMakefileå½¢å¼ã§æ¸ãã A.d ãçæ -include $(ALL_D) # main.d 㨠A.d ãèªã¿è¾¼ã (ç¡ãå ´å㯠%.d:... ã§ä½æ)
ãã¡ã¤ã«ã®åé ã® ALL_C
㨠ALL_O
ã¯æå³ããããã¨æãããALL_D
ã«ã¤ãã¦ã¯èª¬æãå¿
è¦ã ããã
å®ã¯ gcc ã«ã¯ããªããã»ããµã® cpp ãå«ã¾ãã¦ããã
$ cpp -MM A.c -MF A.d
ã¨ãããã¨ã§ A.c ãåç §ãã¦ããä»ã®ã½ã¼ã¹ãããããã¡ã¤ã«ã®æ å ±ã Makefile å½¢å¼ã§åå¾ã§ããã A.d ã®ä¸èº«ã¯ä»¥ä¸ã®ãããªæã
A.o: ../src/A.c ../inc/mA.h ../inc/A.h ../inc/B.h
ãããè¦ãã°ãA.d ãèªã¿è¾¼ã Makefile 㯠A.d ã¨åããã£ã¬ã¯ããªã«è¨ç½®ããå¿ è¦ãããã¨åããã ããã ããããäºæ 㧠root/Makefile ãã root/obj/Makefile ãåé¢ããã
cpp ãã¦å¾ããã A.d ããã¡ã¤ã«æ«å°¾ã® -include $(ALL_D)
ã«ããèªã¿è¾¼ãã°ã
æ¢ã«å®ç¾©ããã¦ãããã¿ã¼ã³ãããã以ä¸ã®ããã«ä¸æ¸ãããã
# ä¸æ¸ãå %.o: ../src/%.c $(CC) -c $< -o $@ # ä¸æ¸ãå¾ A.o: ../src/A.c ../inc/mA.h ../inc/A.h ../inc/B.h $(CC) -c $< -o $@
ããã§ãªãã¸ã§ã¯ããã¡ã¤ã«ã®ä¾åé¢ä¿ã解決ããæ£ããåã³ã³ãã¤ã«ã§ããããã«ãªã£ãããã ã
ã¾ã¨ã
make ã³ãã³ããå©ããå¾ã®å¦çå 容ãã¾ã¨ãã¦ããã
- root ãã£ã¬ã¯ããªã§ make ã³ãã³ããå©ãã
- root/Makefile ã®æåã®ãã«ãå½ä»¤
exec.out: $(ALL_CH)
ã«åºã¥ããä»»æã®ã½ã¼ã¹ã»ããããã¡ã¤ã«ãå¤åãã¦ããã° exec.out ãæ´æ°ãããã¨ããã cd obj && $(MAKE)
ã«ãããroot/obj/Makefile ã® make ãå®è¡ã- root/obj/Makefile ã®æçµè¡
-include $(ALL_D)
ã«ãããA.d 㨠main.d ãèªã¿è¾¼ããã¨ããã %.d: ../src/%.c $(ALL_H)
ã«ããã対象ã®ã½ã¼ã¹ãä»»æã®ããããã¡ã¤ã«ãå¤åãã¦ããã° A.d 㨠main.d ãæ´æ°ã- A.d 㨠main.d ãèªã¿è¾¼ãã
- ãã¿ã¼ã³ãããã®
%.o: ../src/%.c
ã A.d 㨠main.d ã«æ¸ãããä¾åé¢ä¿ã§ä¸æ¸ããããã - root/obj/Makefile ã®æåã®ãã«ãå½ä»¤
dummy: $(ALL_O)
ãå®è¡ã - dummyã®å¦çã¯ä½ããªãããä¾åãã¡ã¤ã«ã¨ã㦠main.o 㨠A.o ãæå®ããã¦ããã®ã§ãããããæ´æ°ãããã¨ããã
- (7ã§ä¸æ¸ããã)ä¾åé¢ä¿ã«åºã¥ãã¦ãmain.o 㨠A.o ãæ´æ°ããå¿ è¦ããããå¤æã
- å¿
è¦ã¨å¤æãããã°
$(CC) -c $< -o $@
ãå®è¡ãã¦ãmain.o 㨠A.o ãæ´æ°ã - dummy ã®å¦ç(ä½ãããªã)ãçµãã£ãã®ã§ãroot/Makefile ã«æ»ãã
$(CC) $(ALL_O) -o $@
ãå®è¡ããexec.out ãæ´æ°ã
ãã¼ããããããã å¦çé åºã¨ãã¦ã¯ 1,2,3 ã®å¾ã« 8,9,10,… ã¨ãããããã ãã8ãè¡ãåã« root/obj/Makefile ã®äºåæºåã¨ã㦠4,5,6,7 ãå®è¡ãããæãã ãªã
Cè¨èªããLAPACKã®zheevãå¼ãã§ã¨ã«ãã¼ãè¡åã対è§å
ææ¸ããè¨äºã®ã³ã¡ã³ãã§zheevã®ä½¿ãæ¹ãæ¸ãã¨è¨ãããã ãªã®ã§æ¸ãããåã¯åªãããªãã ããããã®ã¯ä»äººãæ¸ããè¨äºãéµåã¿ã«ãããããzheev.fã§ã°ã°ã£ã¦ãããããä¸æ¬¡æ å ±ãè¦ãã»ããããã¨æããã Fortranãåãããªãã¦ãæ®éã«èªããã¨æãã å(ãå«ããä¸è¬ã¦ã¼ã¶ã¼)ã®è§£èª¬ã¯å¾ã ã«ãã¦ééã£ã¦ãããã§ãéä¿¡ããã®ã¯ãããããã
/* * SIZE*SIZEåã®ã¨ã«ãã¼ãè¡åã®åºæå¤ã¨åºæãã¯ãã«ãè¨ç® * (1 -2i) * (+2i 1) */ #include <stdio.h> #include <complex.h> #define SIZE 2 int main(void) { // è¤ç´ è¡å(ã¨ã«ãã¼ã)ã®å¯¾è§å (å ¥åè¡åã®é åã¯å¯¾è§åå¾ã«ã¦ãã¿ãªè¡åã«ãªã) char jobz = 'V' ;// åºæãã¯ãã«ãè¨ç®ãã char uplo = 'U' ;// Aã«ä¸ä¸è§è¡åãæ ¼ç´ int n = SIZE ;// 対è§åããæ£æ¹è¡åã®ãµã¤ãº double _Complex A[SIZE*SIZE];// 対è§åããè¡åã対è§åå¾ã¯åºæãã¯ãã«ã並㶠A[0]=1; A[2]=-2*I; A[1]=2*I; A[3]=1; double w[SIZE] ;// å®åºæå¤ãå°ããé ã«å ¥ã int lda = SIZE ;// 対è§åããæ£æ¹è¡åã®ãµã¤ãº double _Complex work[6*SIZE];// 対è§åããéã«ä½¿ç¨ããã¡ã¢ãª int lwork = 6*SIZE ;// workã®æ¬¡å double rwork[3*SIZE-2] ;// 3*SIZE-2ã§åºå® int info ;// æåããã°0ã失æããã°0以å¤ãè¿ã zheev_( &jobz, &uplo, &n, A, &lda, w, work, &lwork, rwork, &info ); // 1çªç®ã®åºæå¤ : w[0] 1çªç®ã®åºæãã¯ãã« : (A[0] A[1]) // 2çªç®ã®åºæå¤ : w[1] 2çªç®ã®åºæãã¯ãã« : (A[2] A[3]) printf("1çªç®ã®åºæå¤:%5.3lf\n",w[0]); printf("1çªç®ã®åºæãã¯ãã«:(%5.3lf %+5.3lf*I %5.3lf %+5.3lf*I)\n", creal(A[0]), cimag(A[0]), creal(A[1]), cimag(A[1])); printf("1çªç®ã®åºæå¤:%5.3lf\n",w[1]); printf("2çªç®ã®åºæãã¯ãã«:(%5.3lf %+5.3lf*I %5.3lf %+5.3lf*I)\n", creal(A[2]), cimag(A[2]), creal(A[3]), cimag(A[3])); return 0; }
ã³ã³ãã¤ã«ã¨å®è¡çµæ
$ gcc hoge.c -lm -lblas -llapack $ ./a.out 1çªç®ã®åºæå¤:-1.000 1çªç®ã®åºæãã¯ãã«:(0.000 +0.707*I 0.707 +0.000*I) 1çªç®ã®åºæå¤:3.000 2çªç®ã®åºæãã¯ãã«:(0.000 -0.707*I 0.707 +0.000*I)