Julia 中文文档Int" julia> gen1(1) "original definition" julia> gen2(1) "definition for Int" 生成函数的每个方法都有自己的已定义函数视图: julia> @generated gen1(x::Real) = f(x); julia> gen1(1) "definition for Type{Int}" 上例中的生成函数 foo 将输入索引向量存储在 SubArray 对象中, 该对象稍后可用于间接索引原始数组。通过将 @views 宏放在表达式或代码块之前,该表达式中的任 何 array [...] 切片将被转换为创建一个 SubArray 视图。 BitArray 是节省空间“压缩”的布尔数组,每个比特(bit)存储一个布尔值。它们可以类似于 Array{Bool} 数组(每个字节(byte)存储一个布尔值),并且可以分别通过 Array(bitarray) 列序优先方式访问数组的原因相同(请参见上文)。由于不按顺序访问内存,无规律的访问方式和不 连续的视图可能会大大减慢数组上的计算速度。 在对无规律访问的数据进行操作前,将其复制到连续的数组中可能带来巨大的加速,正如下例所示。 其中,矩阵和向量在相乘前会访问其 800,000 个已被随机混洗的索引处的值。将视图复制到普通数 组会加速乘法,即使考虑了复制操作的成本。 julia> using Random0 码力 | 1238 页 | 4.59 MB | 1 年前3
Julia 1.11.4julia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3);CHAPTER row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________ 4 = elements in each 4d slice (4,) ⇒ shape = ((2, 1, 1), (3, 1), (4,), IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 Documentationjulia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3);CHAPTER row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________ 4 = elements in each 4d slice (4,) ⇒ shape = ((2, 1, 1), (3, 1), (4,), IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release Notesjulia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3);CHAPTER row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________ 4 = elements in each 4d slice (4,) ⇒ shape = ((2, 1, 1), (3, 1), (4,), IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.13.0 DEVjulia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3); julia> row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________ 4 = elements in each 4d slice (4,) ⇒ shape = ((2, 1, 1), (3, 1), (4,), IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.12.0 RC1julia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3); julia> row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________CHAPTER 48. ARRAYS 1088 4 = elements in each 4d slice (4,) ⇒ shape = ((2 IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4julia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3); julia> row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________CHAPTER 48. ARRAYS 1087 4 = elements in each 4d slice (4,) ⇒ shape = ((2 IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3julia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3); julia> row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________CHAPTER 48. ARRAYS 1087 4 = elements in each 4d slice (4,) ⇒ shape = ((2 IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2057 页 | 7.44 MB | 3 月前3
julia 1.12.0 beta1julia> cat(a, b; dims=(1, 2)) 2×6 Matrix{Int64}: 1 2 3 0 0 0 0 0 0 4 5 6 Extended Help Concatenate 3D arrays: julia> a = ones(2, 2, 3); julia> b = ones(2, 2, 4); julia> c = cat(a, b; dims=3); julia> row (2, 1, 1) _______ _ 3 1 = elements in each column (3, 1) _____________ 4 = elements in each 3d slice (4,) _____________CHAPTER 47. ARRAYS 1079 4 = elements in each 4d slice (4,) ⇒ shape = ((2 IndexLinear to the extent that it is possible. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64, 3}, :, 10 码力 | 2047 页 | 7.41 MB | 3 月前3
Julia 1.1.0 Documentationexpression A[5] returns the value 5. Julia allows you to combine these styles of indexing: for example, a 3d array A3 can be indexed as A3[i,j], in which case i is interpreted as a cartesian index for the first terms of cartesian, rather than linear, indexing. Index replacement Consider making 2d slices of a 3d array: julia> A = rand(2,3,4); julia> S1 = view(A, :, 1, 2:3) 2×2 view(::Array{Float64,3}, :, 1,0 码力 | 1214 页 | 4.21 MB | 1 年前3
共 87 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













