Julia Juno Jupyter part1 [無断転載禁止]©2ch.net (745レス)
Julia Juno Jupyter part1 [無断転載禁止]©2ch.net http://mevius.5ch.net/test/read.cgi/tech/1455271513/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
1: デフォルトの名無しさん [] 2016/02/12(金) 19:05:13.83 ID:zhNvVfnf LLVM で動く Julia のお勉強 Python に少し似てネイティブの速さで動く素敵な関数型言語 http://julialang.org/ http://junolab.org/ http://jupyter.org/ 関連 Pythonista のための Julia 100 問 100 答 http://bicycle1885.hatenablog.com/entry/2014/12/23/170745 http://mevius.5ch.net/test/read.cgi/tech/1455271513/1
2: デフォルトの名無しさん [sage] 2016/02/12(金) 19:06:27.32 ID:zhNvVfnf みなさんの貢献が求められています http://pkg.julialang.org/ http://docs.julialang.org/en/release-0.4/manual/packages/ http://mevius.5ch.net/test/read.cgi/tech/1455271513/2
3: デフォルトの名無しさん [sage] 2016/02/12(金) 19:11:52.52 ID:zhNvVfnf C の関数を呼ぶのも簡単 http://docs.julialang.org/en/release-0.4/manual/calling-c-and-fortran-code/ ツールが無くても可能ですが他にも便利なのがあるのでお好みで Clang.jl https://github.com/ihnorton/Clang.jl Cpp.jl https://github.com/timholy/Cpp.jl Cxx.jl https://github.com/Keno/Cxx.jl http://mevius.5ch.net/test/read.cgi/tech/1455271513/3
4: デフォルトの名無しさん [sage] 2016/02/12(金) 19:36:28.01 ID:zhNvVfnf 私が Julia を推す理由 (翻訳) http://d.hatena.ne.jp/isobe1978/20140330/1396201066 原文 http://www.evanmiller.org/why-im-betting-on-julia.html Julia の開発環境を構築してみる (IJulia) http://qiita.com/miiton@github/items/33c2b62c4911216d5fdb 科学計算が得意な言語 Julia を試してみた http://qiita.com/chezou/items/d090f26dcb31818d6964 Gadfly http://gadflyjl.org/ Plotly https://plot.ly/julia/ http://mevius.5ch.net/test/read.cgi/tech/1455271513/4
5: デフォルトの名無しさん [sage] 2016/02/12(金) 23:29:57.13 ID:5fxI8DGs 実は数年前にここでjuliaスレ立てたんだが落ちたんだよなあ。。。。 http://mevius.5ch.net/test/read.cgi/tech/1455271513/5
6: デフォルトの名無しさん [sage] 2016/02/13(土) 10:10:05.58 ID:3L3e3K/U 漏れもなんとなく見覚えがある気がするんだよなぁ・・・ 落ちる条件ってなんだっけ http://mevius.5ch.net/test/read.cgi/tech/1455271513/6
7: デフォルトの名無しさん [sage] 2016/02/13(土) 10:11:00.83 ID:3L3e3K/U という訳で保守がてら juliaからCの関数を呼んでみた julia> ccall(:printf, Void, (Ptr{Cchar}, Ptr{Cchar}), "%s", "abc") abc julia> ccall(:printf, Void, (Ptr{Cchar}, Ptr{Cchar}, Int), "%s%d", "abc", 9) abc9 引数の数が自由なのがいいねっ! http://mevius.5ch.net/test/read.cgi/tech/1455271513/7
8: デフォルトの名無しさん [sage] 2016/02/13(土) 10:12:28.35 ID:3L3e3K/U おれおれDLLだと呼び出し方がちょっと変わるみたい (最近仕様が変わったらしいので古いドキュソの通りやると動かない っていうか最新のドキュソもまだ動かないサンプルのままだぞω) julia> libcurl = Base.Libdl.dlopen_e("./libcurl.dll") Ptr{Void} @0x2c76e2c0 julia> curl_version = Base.Libdl.dlsym(libcurl, :curl_version) Ptr{Void} @0x6b25c740 julia> curl_getenv = Base.Libdl.dlsym(libcurl, :curl_getenv) Ptr{Void} @0x6b25c854 julia> curl_free = Base.Libdl.dlsym(libcurl, :curl_free) Ptr{Void} @0x6b25cbf8 julia> p = ccall(curl_version, Ptr{Cchar}, ()) Ptr{Int8} @0x6b29c060 julia> ccall(:printf, Void, (Ptr{Cchar}, Ptr{Cchar}), "%s", p) libcurl/7.30.0 OpenSSL/1.0.1e zlib/1.2.7 julia> q = ccall(curl_getenv, Ptr{Cchar}, (Ptr{Cchar}, ), "NUMBER_OF_PROCESSORS") Ptr{Int8} @0x2c76df10 julia> ccall(:printf, Void, (Ptr{Cchar}, Ptr{Cchar}), "%s", q) 8 julia> ccall(curl_free, Cuint, (Ptr{Void}, ), q) 0x00000001 julia> Base.Libdl.dlclose(libcurl) うっかり解放忘れそう http://mevius.5ch.net/test/read.cgi/tech/1455271513/8
9: デフォルトの名無しさん [] 2016/02/13(土) 10:14:00.39 ID:3L3e3K/U stdcallな関数だとさらにこんな感じだよ julia> user32 = Base.Libdl.dlopen_e("user32.dll") Ptr{Void} @0x2c767300 julia> MessageBoxA = Base.Libdl.dlsym(user32, :MessageBoxA) Ptr{Void} @0x76c6cf50 julia> err = ccall(MessageBoxA, stdcall, UInt, (Ptr{UInt}, Ptr{Cchar}, Ptr{Cchar}, UInt), 0, "Hello, work!", "Message", 0) 0x00000001 wchar_tはArray{UInt16,1}らしい(UTF8を表示したければ先にwchar_tへの変換が必要) julia> MessageBoxW = Base.Libdl.dlsym(user32, :MessageBoxW) Ptr{Void} @0x76c6d280 julia> err = ccall(MessageBoxW, stdcall, UInt, (Ptr{UInt}, Ptr{Cwchar_t}, Ptr{Cwchar_t}, UInt), 0, Array{UInt16,1}([0x304C,0x3063,0xFF01,0]), Array{UInt16,1}([0x306C,0x308B,0x307D,0]), 0) 0x00000001 julia> Base.Libdl.dlclose(user32) 解放解放 引数や戻り値の定義を呼び出しのたびに何度も書くの面倒なのでマクロを書くのが良いらしいよ http://mevius.5ch.net/test/read.cgi/tech/1455271513/9
10: デフォルトの名無しさん [sage] 2016/02/13(土) 10:17:20.41 ID:3L3e3K/U >っていうか最新のドキュソもまだ動かないサンプルのままだぞω ああごめん動くわ http://mevius.5ch.net/test/read.cgi/tech/1455271513/10
11: デフォルトの名無しさん [sage] 2016/02/13(土) 10:22:27.58 ID:3L3e3K/U ccall(:printf, Void, (Ptr{Cchar}, Ptr{Cchar}), "%s", ccall((:curl_version, :libcurl), Ptr{Cchar}, ())) err = ccall((:MessageBoxW, :user32), stdcall, UInt, (Ptr{UInt}, Ptr{Cwchar_t}, Ptr{Cwchar_t}, UInt), 0, Array{UInt16,1}([0x304C,0x3063,0xFF01,0]), Array{UInt16,1}([0x306C,0x308B,0x307D,0]), 0) Array{UInt16,1}のところはArray{Cwchar_t}とかVector{Cwchar_t}とも書ける err = ccall((:MessageBoxW, :user32), stdcall, UInt, (Ptr{UInt}, Ptr{Cwchar_t}, Ptr{Cwchar_t}, UInt), 0, Vector{Cwchar_t}([0x304C,0x3063,0xFF01,0]), Array{Cwchar_t}([0x306C,0x308B,0x307D,0]), 0) これでいいね loadは省けるけど毎回loadと解放してくれてるんだろうか http://mevius.5ch.net/test/read.cgi/tech/1455271513/11
12: デフォルトの名無しさん [sage] 2016/02/13(土) 10:31:38.04 ID:Qsay8O0p >>8 >OpenSSL/1.0.1e ワロス http://mevius.5ch.net/test/read.cgi/tech/1455271513/12
13: デフォルトの名無しさん [] 2016/02/13(土) 11:59:14.88 ID:3L3e3K/U もう少しちらうら julia> bytes2hex([65,97,66,98,0x5c]) ERROR: MethodError: `bytes2hex` has no method matching bytes2hex(::Array{Int32,1}) julia> bytes2hex(Array{UInt8,1}([65,97,66,98,0x5c])) "416142625c" julia> bytestring(Array{UInt8,1}([65,97,66,98,0x5c])) "AaBb\\" julia> hex2bytes("416142625c") 5-element Array{UInt8,1}: 0x41 0x61 0x42 0x62 0x5c julia> string2bytes("AaBb\\") ERROR: UndefVarError: string2bytes not defined julia> stringbytes("AaBb\\") ERROR: UndefVarError: stringbytes not defined julia> read(IOBuffer("AaBb\\")) ERROR: MethodError: `read` has no method matching read(::Base.AbstractIOBuffer{Array{UInt8,1}}) julia> read(IOBuffer("AaBb\\"), UInt8) 0x41 julia> read(IOBuffer("AaBb\\"), UInt8, length("AaBb\\")) 5-element Array{UInt8,1}: 0x41 0x61 0x42 0x62 0x5c んー マニュアルにはreaddim()があるって書いてあるのに・・・ 何かimport忘れてるとか? length省略できんのもなんだかな 勘違いならいいけど http://mevius.5ch.net/test/read.cgi/tech/1455271513/13
14: デフォルトの名無しさん [sage] 2016/02/13(土) 17:12:04.67 ID:AfSbfh5s ちょっと前から同名のAV女優が出てきて検索がちょっとアレになったよね 運が悪い http://mevius.5ch.net/test/read.cgi/tech/1455271513/14
15: デフォルトの名無しさん [sage] 2016/02/13(土) 17:45:27.64 ID:6qRaMcc6 "どうすればPythonをJuliaと同じくらい速く動かせるのか? : 様々なやり方で計算の高速化を図る" http://postd.cc/python_meets_julia_micro_performance/ http://mevius.5ch.net/test/read.cgi/tech/1455271513/15
16: デフォルトの名無しさん [] 2016/02/13(土) 22:04:46.56 ID:zoieo+tE フォートランっぽい文法狂おしいほど嫌い http://mevius.5ch.net/test/read.cgi/tech/1455271513/16
17: デフォルトの名無しさん [sage] 2016/02/14(日) 11:00:37.07 ID:7sraJ7/r パッケージがおれおれやってみたばっかりで まともなものが少ねーじゃねーか これ PyPI よりひでーぞ github っつーかオプソは害だな http://mevius.5ch.net/test/read.cgi/tech/1455271513/17
18: デフォルトの名無しさん [] 2016/02/14(日) 11:01:38.90 ID:7sraJ7/r >>16 21世紀にもなって添え字が 1 から始まるとかもうね http://mevius.5ch.net/test/read.cgi/tech/1455271513/18
19: デフォルトの名無しさん [sage] 2016/02/14(日) 11:11:08.67 ID:FXwepV/m おまいらなんだかんだ言って みんなそれなりにやってんだな ニヤニヤ http://mevius.5ch.net/test/read.cgi/tech/1455271513/19
20: デフォルトの名無しさん [] 2016/02/14(日) 19:24:28.30 ID:UnbFC5qc >1 乙 >14 前スレで見た覚えがある >16 それな http://mevius.5ch.net/test/read.cgi/tech/1455271513/20
21: デフォルトの名無しさん [] 2016/02/15(月) 10:16:09.06 ID:TvNTryet コンパイル中のエラーよりも実行時の型エラーの方が厄介な言語だなこいつは。 慣れれば問題ないが。 http://mevius.5ch.net/test/read.cgi/tech/1455271513/21
22: デフォルトの名無しさん [] 2016/02/15(月) 10:20:41.18 ID:TvNTryet >>13 非推奨っぽいが、 これでいいらしい。 "AaBb\\".data 代入も出来るようだ。 s = "AaBb\\" s.data[2] = UInt8(64) s http://mevius.5ch.net/test/read.cgi/tech/1455271513/22
23: デフォルトの名無しさん [] 2016/02/15(月) 10:21:13.05 ID:TvNTryet これは割りと嬉しいかも。 julia> @sprintf "ab [%7s]" "xあx" "ab [ xあx]" julia> @sprintf "ab [%-7s]" "xあx" "ab [xあx ]" julia> @sprintf "ab [%7s]" "xxx" "ab [ xxx]" julia> @sprintf "ab [%-7s]" "xxx" "ab [xxx ]" http://mevius.5ch.net/test/read.cgi/tech/1455271513/23
24: デフォルトの名無しさん [] 2016/02/15(月) 10:31:07.93 ID:TvNTryet うむむ julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("")) "ab [ ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141E381824141")) "ab [AAあAA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141E981824141")) "ab [AA遂AA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141Ee81824141")) "ab [AA\ue042AA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141Ef81824141")) "ab [AA\uf042AA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141E881824141")) "ab [AA聂AA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141E8e8824141")) "ab [AA騂AA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("4141E9e8824141")) "ab [AAꨂAA ]" julia> @sprintf "ab [%-7s]" bytestring(hex2bytes("414155aa554141")) ERROR: UnicodeError: invalid character index in next at unicode/utf8.jl:65 in strwidth at strings/basic.jl:205 [inlined code] from printf.jl:159 in anonymous at no file:0 julia> @sprintf "ab [%-7s]" hex2bytes("414155aa554141") "ab [UInt8[0x41,0x41,0x55,0xaa,0x55,0x41,0x41]]" http://mevius.5ch.net/test/read.cgi/tech/1455271513/24
25: デフォルトの名無しさん [sage] 2016/02/15(月) 11:19:37.91 ID:TvNTryet >>11 julia> ccall((:curl_version, :libcurl), Ptr{Cchar}, ()) Ptr{Int8} @0x6b29c060 julia> @sprintf "%s" ccall((:curl_version, :libcurl), Ptr{Cchar}, ()) "Ptr{Int8} @0x6b29c060" んーこれも期待した動作と違うなぁ。 http://mevius.5ch.net/test/read.cgi/tech/1455271513/25
26: デフォルトの名無しさん [sage] 2016/02/15(月) 11:28:27.71 ID:TvNTryet >>16 ifに括弧なしは一見便利だけどend強制されるのはPythonに慣れてるとうざく感じる。 julia> Array{UInt8}([1:n;]) == map(a -> UInt8(a), 1:n) true ちょっと気持ち悪いところもある。 http://mevius.5ch.net/test/read.cgi/tech/1455271513/26
27: デフォルトの名無しさん [sage] 2016/02/15(月) 11:32:12.26 ID:TvNTryet julia> Array{UInt8}([1:n;]) == map(a -> UInt8(a), (1:n)) true julia> Array{UInt8}([1:n]) == map(a -> UInt8(a), (1:n)) 警告出るが true (二回目からは警告出なくなる?) julia> Array{UInt8}((1:n)) == map(a -> UInt8(a), (1:n)) エラー http://mevius.5ch.net/test/read.cgi/tech/1455271513/27
28: デフォルトの名無しさん [sage] 2016/02/15(月) 11:45:55.52 ID:2YjvKDPc >>25 bytestring(ccall((:curl_version, :libcurl), Ptr{Cchar}, ())) http://mevius.5ch.net/test/read.cgi/tech/1455271513/28
29: デフォルトの名無しさん [sage] 2016/02/15(月) 11:49:21.03 ID:TvNTryet >>28 有賀?。 >>24でも書いたけどbytestringってこんなデータ来ると死ぬから使いたくないなぁ。 julia> bytestring(hex2bytes("414155aa554141")) http://mevius.5ch.net/test/read.cgi/tech/1455271513/29
30: デフォルトの名無しさん [sage] 2016/02/15(月) 12:16:36.12 ID:TvNTryet julia> pointer_to_array(ccall((:curl_version, :libcurl), Ptr{Cchar}, ()), n) でnバイト分のArray{Int8}になるみたいだけどなぜかデフォでUInt8じゃないのが気に入らないなぁ。 julia> Array{UInt8}(pointer_to_array(ccall((:curl_version, :libcurl), Ptr{Cchar}, ()), n)) とかいちいち書くの面倒だなぁ。 http://mevius.5ch.net/test/read.cgi/tech/1455271513/30
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 715 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.009s