 protocol Matrix {
+    var count: Int { get }
     var m : [Float] { get set }
     subscript( row: Int, col: Int ) -> Float { get set }
 }

struct Mat<R:Nat, C:Nat>: Matrix {
    private var rows: Int
    private var cols: Int
    var m: [Float]
    subscript( row: Int, col: Int ) -> Float {
        get {


    return Mat<C,R>( r: mat.rows, c: mat.cols, m: m )
}

func +<T: SpecializedMatrix>( left: T, right: T ) -> T {
    var m = [Float]( count: left.count, repeatedValue: 0.0 )
    for n in 0...left.count - 1 {
        m[n] = left[n] + right[n]
    }
    return T( m: m )
}

func -<T: SpecializedMatrix>( left: T, right: T ) -> T {
    var m = [Float]( count: left.count, repeatedValue: 0.0 )
    for n in 0...left.count - 1 {
        m[n] = left[n] - right[n]
    }
    return T( m: m )
}
