Skip to content

Commit 331ad9b

Browse files
authored
Avoid unnecessary matrix zero-initialization (#1930)
1 parent c9e4923 commit 331ad9b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Matrix.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6492,7 +6492,7 @@ end
64926492

64936493
# like change_base_ring, but without initializing the entries
64946494
# this function exists until a better API is implemented
6495-
_change_base_ring(R::NCRing, a::MatElem) = zero_matrix(R, nrows(a), ncols(a))
6495+
_change_base_ring(R::NCRing, a::MatElem) = dense_matrix_type(R)(R, undef, nrows(a), ncols(a))
64966496
_change_base_ring(R::NCRing, a::MatRingElem) = matrix_ring(R, nrows(a))()
64976497

64986498
@doc raw"""
@@ -6707,7 +6707,7 @@ function matrix(R::NCRing, arr::MatElem)
67076707
end
67086708

67096709
function matrix(R::NCRing, arr::MatRingElem)
6710-
M = zero_matrix(R, nrows(arr), ncols(arr))
6710+
M = dense_matrix_type(R)(R, undef, nrows(arr), ncols(arr))
67116711
for i in 1:nrows(arr), j in 1:ncols(arr)
67126712
M[i, j] = arr[i, j]
67136713
end

0 commit comments

Comments
 (0)