 //  Created by Taketo Sano on 2021/05/14.
 //
 
+//  Implemented with DOK (dictionary of keys) format.
+//  https://en.wikipedia.org/wiki/Sparse_matrix#Dictionary_of_keys_(DOK)
+//  Not intended for fast computation.
+
 public struct DefaultMatrixImpl<R: Ring>: SparseMatrixImpl {
     public typealias BaseRing = R
-    fileprivate typealias Data = [Index : R]
+    public typealias Data = [Index : R]
     
     public var size: (rows: Int, cols: Int)
-    private var data: Data
+    public private(set) var data: Data
     
     private init(size: MatrixSize, data: Data) {
         assert(size.0 >= 0)

        )
    }
    
    private func mapNonZeroEntries(_ f: (Int, Int, R) -> R) -> Self {
        .init(size: size) { setEntry in
            nonZeroEntries.forEach { (i, j, a) in setEntry(i, j, f(i, j, a)) }
        }
    }
    
    fileprivate struct Index: Hashable {
        let row, col: Int
        init(_ row: Int, _ col: Int) {
            self.row = row
            self.col = col
        }

    }

    public subscript(i: Int, j: Int) -> R {
        @inlinable
        get {
            data[Index(i, j)] ?? .zero
        } set {
