用法:
cat(A...; dims)
沿可迭代 dims
中的指定維度連接輸入數組。對於不在 dims
中的維度,所有輸入數組都應具有相同的大小,這也是沿該維度的輸出數組的大小。對於 dims
中的維度,輸出數組的大小是沿該維度的輸入數組大小的總和。如果dims
是單個數字,則不同的數組沿該維度緊密堆疊。如果dims
是包含多個維度的可迭代對象,則可以通過同時為每個新輸入數組增加多個維度並將零塊放在其他位置來構造塊對角矩陣及其高維類似物。例如,cat(matrices...; dims=(1,2))
構建塊對角矩陣,即以 matrices[1]
、 matrices[2]
、... 作為對角塊並匹配遠離對角線的零塊的塊矩陣。
另見
、hcat
、vcat
、hvcat
。repeat
例子
julia> cat([1 2; 3 4], [pi, pi], fill(10, 2,3,1); dims=2)
2×6×1 Array{Float64, 3}:
[:, :, 1] =
1.0 2.0 3.14159 10.0 10.0 10.0
3.0 4.0 3.14159 10.0 10.0 10.0
julia> cat(true, trues(2,2), trues(4)', dims=(1,2))
4×7 Matrix{Bool}:
1 0 0 0 0 0 0
0 1 1 0 0 0 0
0 1 1 0 0 0 0
0 0 0 1 1 1 1
相關用法
- Julia cis方法用法及代碼示例
- Julia cld用法及代碼示例
- Julia codeunit用法及代碼示例
- Julia cos方法用法及代碼示例
- Julia count_ones用法及代碼示例
- Julia checkbounds用法及代碼示例
- Julia countlines用法及代碼示例
- Julia collect方法用法及代碼示例
- Julia cis用法及代碼示例
- Julia cispi用法及代碼示例
- Julia complex方法用法及代碼示例
- Julia chomp()用法及代碼示例
- Julia cmp用法及代碼示例
- Julia coalesce用法及代碼示例
- Julia copyto!用法及代碼示例
- Julia checkindex用法及代碼示例
- Julia circcopy!用法及代碼示例
- Julia conj!用法及代碼示例
- Julia convert用法及代碼示例
- Julia copyto!()用法及代碼示例
- Julia cumprod用法及代碼示例
- Julia cumsum用法及代碼示例
- Julia chop()用法及代碼示例
- Julia ceil()用法及代碼示例
- Julia codeunits用法及代碼示例
注:本文由純淨天空篩選整理自julialang.org 大神的英文原創作品 Base.cat — Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。