-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consistently check matrix sizes in matmul (#1152)
Fixes #1147, and makes the error messages more verbose. Before ```julia julia> zeros(0,4) * zeros(1) ERROR: DimensionMismatch: second dimension of matrix, 4, does not match length of input vector, 1 [...] julia> mul!(zeros(0), zeros(2,2), zeros(2)) ERROR: DimensionMismatch: first dimension of matrix, 2, does not match length of output vector, 0 [...] ``` After ```julia julia> zeros(0,4) * zeros(1) ERROR: DimensionMismatch: incompatible dimensions for matrix multiplication: tried to multiply a matrix of size (0, 4) with a vector of length 1. The second dimension of the matrix: 4, does not match the length of the vector: 1. [...] julia> zeros(0,4) * zeros(1,1) ERROR: DimensionMismatch: incompatible dimensions for matrix multiplication: tried to multiply a matrix of size (0, 4) with a matrix of size (1, 1). The second dimension of the first matrix: 4, does not match the first dimension of the second matrix: 1. [...] julia> mul!(zeros(0), zeros(2,2), zeros(2)) ERROR: DimensionMismatch: incompatible destination size: the destination vector of length 0 is incomatible with the product of a matrix of size (2, 2) and a vector of length 2. The destination must be of length 2. [...] julia> mul!(zeros(0,1), zeros(3,2), zeros(2,3)) ERROR: DimensionMismatch: incompatible destination size: the destination matrix of size (0, 1) is incomatible with the product of a matrix of size (3, 2) and a matrix of size (2, 3). The destination must be of size (3, 3). [...] ```
- Loading branch information
Showing
6 changed files
with
128 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.