Skip to content

Commit

Permalink
QC : Fix MatrixSeq POs; transpose type on seq of seq to seq of @t
Browse files Browse the repository at this point in the history
  • Loading branch information
leouk committed Nov 10, 2024
1 parent 0910350 commit 302ce83
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions vdmlib/src/main/resources/Matrix_Seq.vdmsl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ functions
measure
len zip[@T,@T](v,w);

--@QuickCheck @T = nat
row[@T]: Matrix * Index -> Vector
row(m,r) ==
seqMapH[seq of @T, @T]((lambda v: seq of @T & v(r)), m)
Expand Down Expand Up @@ -190,12 +191,18 @@ functions
transpose[@T]: nat * Matrix -> Matrix
transpose(nr, m) ==
cases m:
[] -> replicate[seq of @T](nr,[]),
[v]^m' -> let f: (@T * (seq of @T)) -> (seq of seq of @T) = (lambda vi_mi: (@T * (seq of @T)) & [vi_mi.#1] ^ vi_mi.#2),
s: seq of (@T * (seq of @T)) = zip[@T,seq of @T](v, transpose[@T](nr,m'))
in
[ f(s(i)) | i in set inds s ]
--seqMap[(@T * (seq of @T)), (seq of seq of @T), (seq of @T)](f,s)
[] -> replicate[seq of @T](nr,[]),
[v]^m' ->
let f: (@T * (seq of @T)) -> (seq of @T)
=
(lambda vi_mi: (@T * (seq of @T)) & [vi_mi.#1] ^ vi_mi.#2),

s: seq of (@T * (seq of @T))
=
zip[@T,seq of @T](v, transpose[@T](nr,m'))
in
[ f(s(i)) | i in set inds s ]
--seqMap[(@T * (seq of @T)), (seq of seq of @T), (seq of @T)](f,s)
end
pre
matrix_of_t[@T](m)
Expand Down

0 comments on commit 302ce83

Please sign in to comment.