parent
935fcfb6ec
commit
43dfc2a25f
1 changed files with 2 additions and 4 deletions
|
|
@ -215,7 +215,7 @@ Compares two vectors of the same size using a given boolean relation `r`. `isEqv
|
|||
`true` if and only if `r v[i] w[i]` is true for all indices `i`.
|
||||
-/
|
||||
@[inline] def isEqv (v w : Vector α n) (r : α → α → Bool) : Bool :=
|
||||
Array.isEqvAux v.toArray w.toArray (by simp) r 0 (by simp)
|
||||
Array.isEqvAux v.toArray w.toArray (by simp) r n (by simp)
|
||||
|
||||
instance [BEq α] : BEq (Vector α n) where
|
||||
beq a b := isEqv a b (· == ·)
|
||||
|
|
@ -249,9 +249,7 @@ Finds the first index of a given value in a vector using `==` for comparison. Re
|
|||
no element of the index matches the given value.
|
||||
-/
|
||||
@[inline] def indexOf? [BEq α] (v : Vector α n) (x : α) : Option (Fin n) :=
|
||||
match v.toArray.indexOf? x with
|
||||
| some res => some (res.cast v.size_toArray)
|
||||
| none => none
|
||||
(v.toArray.indexOf? x).map (Fin.cast v.size_toArray)
|
||||
|
||||
/-- Returns `true` when `v` is a prefix of the vector `w`. -/
|
||||
@[inline] def isPrefixOf [BEq α] (v : Vector α m) (w : Vector α n) : Bool :=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue