LinearAlgebra
Equal
compare two Vectors or two Matrices for equality
Calling Sequence
Parameters
Description
Examples
Equal(A, B, c)
A
-
Matrix or Vector
B
c
(optional) equation of the form compare=method where method is one of 'entries', 'structure', or 'all'; type of comparison to make
In any call to Equal(..), A and B must be the same type (both Matrices or both Vectors). Otherwise, Equal(..) returns false.
The Equal(A, B) function returns true if A and B are the same type, have the same dimension, and have equal component-wise data. In particular, if A and B are Vectors, they must also have the same orientation.
Since compare='entries' is the default comparison method, Equal(A, B) and Equal(A, B, compare='entries') are equivalent.
For Matrices, the Equal(A, B, compare='structure') function returns true if A and B have the same dimension, datatype, shape, storage, attributes, and order.
For Vectors, the Equal(A, B, compare='structure') function returns true if A and B have the same dimension, datatype, shape, storage, attributes, and orientation.
The compare='structure' method does not consider the value of the entries in the Matrices or Vectors in its comparison.
The Equal(A, B, compare='all') function is equivalent to the logical AND of compare='entries' and compare='structure'.
This function is part of the LinearAlgebra package, and so it can be used in the form Equal(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[Equal](..).
with⁡LinearAlgebra:
R≔Vectorrow⁡12,32,−15,35,datatype=rational
R≔1232−1535
F≔Vectorrow⁡0.5,1.5,−0.2,0.6,datatype=sfloat
F≔0.51.5−0.20.6
Equal⁡R,F
true
Equal⁡R,F,compare=all
false
S≔2,0|0,2
S≔2002
Equal⁡S,ScalarMatrix⁡2,2,compare=structure
Equal⁡S,ScalarMatrix⁡2,2,compare=entries
See Also
EqualEntries
Matrix
Vector
Download Help Document