#author("2020-10-11T22:30:59+09:00","default:Miyashita","Miyashita")
#author("2020-10-11T22:31:59+09:00","default:Miyashita","Miyashita")
*Functionのメモ [#o3493014]
**戻り値が複数ある関数を broadcast で実行した時の割り当て [#xc509582]
***概要 [#tb208461]
#htmlinsert(Julia/juliafunc_note1.html)

**結局? [#d6f9fa0e]
**結局は… [#d6f9fa0e]
入力 X が 1次元( ndims(X) == 1)で 出力を Tuple ではなく Array にしたい時は
#codeprettify(lang-julia){{
a, b, c = collect.(zip(f.(X)...))
}}

入力 X が 2次元以上 ( ndims(X) > 1) で出力を Array にしたい時は上記の StructArray を使う方法か, zip, collect を利用して
#codeprettify(lang-julia){{
a, b, c = map(x->reshape(x, size(X)), collect.(zip(f.(X)...)))
}}
でも可能.

Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes