             assert( 0 <= i && i < size.0 )
             assert( 0 <= j && j < size.1 )
             if !a.isZero {
-                data[Coord(i, j)] = a
+                data[Index(i, j)] = a
             }
         }
         self.init(size: size, data: data)

        }
        return grid
    }
}

fileprivate struct Coord: Hashable {
    let row, col: Int
    init(_ row: Int, _ col: Int) {
        self.row = row
        self.col = col
    }
    var tuple: (Int, Int) {
        (row, col)
    }
}

fileprivate extension Dictionary where Key == Coord {
    subscript(_ i: Int, _ j: Int) -> Value? {
        get {
            self[Coord(i, j)]
        } set {
            self[Coord(i, j)] = newValue
        }
    }
}

        data.count
    }
    
    public var nonZeroEntries: AnySequence<MatrixEntry<R>> {
        AnySequence(NonZeroEntryIterator(data))
    }
    
    public var isZero: Bool {
