@@ -33,7 +33,7 @@ function colwise!(r::AbstractArray, metric::PreMetric, a::AbstractVector, b::Abs
33
33
n = size (b, 2 )
34
34
length (r) == n || throw (DimensionMismatch (" Incorrect size of r." ))
35
35
for j = 1 : n
36
- @inbounds r[j] = evaluate (metric, a, slice (b, :, j))
36
+ @inbounds r[j] = evaluate (metric, a, view (b, :, j))
37
37
end
38
38
r
39
39
end
@@ -42,7 +42,7 @@ function colwise!(r::AbstractArray, metric::PreMetric, a::AbstractMatrix, b::Abs
42
42
n = size (a, 2 )
43
43
length (r) == n || throw (DimensionMismatch (" Incorrect size of r." ))
44
44
for j = 1 : n
45
- @inbounds r[j] = evaluate (metric, slice (a, :, j), b)
45
+ @inbounds r[j] = evaluate (metric, view (a, :, j), b)
46
46
end
47
47
r
48
48
end
@@ -51,7 +51,7 @@ function colwise!(r::AbstractArray, metric::PreMetric, a::AbstractMatrix, b::Abs
51
51
n = get_common_ncols (a, b)
52
52
length (r) == n || throw (DimensionMismatch (" Incorrect size of r." ))
53
53
for j = 1 : n
54
- @inbounds r[j] = evaluate (metric, slice (a, :, j), slice (b, :, j))
54
+ @inbounds r[j] = evaluate (metric, view (a, :, j), view (b, :, j))
55
55
end
56
56
r
57
57
end
@@ -86,9 +86,9 @@ function pairwise!(r::AbstractMatrix, metric::PreMetric, a::AbstractMatrix, b::A
86
86
nb = size (b, 2 )
87
87
size (r) == (na, nb) || throw (DimensionMismatch (" Incorrect size of r." ))
88
88
for j = 1 : size (b, 2 )
89
- bj = slice (b,:,j)
89
+ bj = view (b,:,j)
90
90
for i = 1 : size (a, 2 )
91
- @inbounds r[i,j] = evaluate (metric, slice (a,:,i), bj)
91
+ @inbounds r[i,j] = evaluate (metric, view (a,:,i), bj)
92
92
end
93
93
end
94
94
r
@@ -102,9 +102,9 @@ function pairwise!(r::AbstractMatrix, metric::SemiMetric, a::AbstractMatrix)
102
102
n = size (a, 2 )
103
103
size (r) == (n, n) || throw (DimensionMismatch (" Incorrect size of r." ))
104
104
for j = 1 : n
105
- aj = slice (a,:,j)
105
+ aj = view (a,:,j)
106
106
for i = j+ 1 : n
107
- @inbounds r[i,j] = evaluate (metric, slice (a,:,i), aj)
107
+ @inbounds r[i,j] = evaluate (metric, view (a,:,i), aj)
108
108
end
109
109
@inbounds r[j,j] = 0
110
110
for i = 1 : j- 1
@@ -132,5 +132,3 @@ function pairwise(metric::SemiMetric, a::AbstractMatrix)
132
132
r = Array (result_type (metric, a, a), (n, n))
133
133
pairwise! (r, metric, a)
134
134
end
135
-
136
-
0 commit comments