Currently also struggling with this type mismatch error with using this
function:
# Remove specified row and column
func submatrix*[W, H](m: Matrix[W, H], rowIdx, colIdx: int): Matrix[W - 1,
H - 1] =
for row in 0 .. high(m):
var resultRow = row
if row == rowIdx: continue
elif row > rowIdx: resultRow.dec(1)
for col in 0 .. high(m[0]):
var resultCol = col
if col == colIdx:
continue
elif col > colIdx: resultCol.dec(1)
result[resultRow][resultCol] = m[row][col]
Run
The error being:
C:\Users\Administrator\.choosenim\toolchains\nim-1.0.6\lib\pure\unittest.nim(665,
14) Error: type misma
tch: got <Matrix[W - 1, H - 1], Matrix[3, 3]>
but expected one of:
proc `==`[I, T](x, y: array[I, T]): bool
first type mismatch at position: 2
required type for y: array[I, T]
but expression ':c2' is of type: Matrix[3, 3]
proc `==`[T](x, y: openArray[T]): bool
first type mismatch at position: 2
required type for y: openArray[T]
but expression ':c2' is of type: Matrix[3, 3]
func `==`[W, H](m1, m2: Matrix[W, H]): bool
first type mismatch at position: 2
required type for m2: Matrix[==.W, ==.H]
but expression ':c2' is of type: Matrix[3, 3]
24 other mismatching symbols have been suppressed; compile with
--showAllMismatches:on to see them
Run