         }
     }
     
+    public func toLaObject(array: [Double], rows: Int, cols: Int) -> la_object_t {
+        let laObject = la_matrix_from_double_buffer( array,
+                                                la_count_t(rows),
+                                                la_count_t(cols),
+                                                la_count_t(cols),
+                                                la_hint_t(LA_NO_HINT),
+                                                la_attribute_t(LA_DEFAULT_ATTRIBUTES))
+       return laObject
+    }                            
+                                                
     private func checkRow(row: Int) -> Int {
         assert(row >= 0 && row < self.rows)
         return (row >= 0) ?  row : self.rows + row

        
        set(value) {
            var buffer = self.flat
            let index = col + row * self.rows
            assert(index >= 0 && index < self.cols * self.rows)
            buffer[index] = value
            // la_release(self.la)
            self.la = la_matrix_from_double_buffer( buffer,
                                                    la_count_t(self.rows),
                                                    la_count_t(self.cols),
                                                    1,
                                                    la_hint_t(LA_NO_HINT),
                                                    la_attribute_t(LA_DEFAULT_ATTRIBUTES))
        }
    }
    
    subscript (row: Int) -> RMatrix {
        get {
            let theRow = checkRow(row)
            let slice = la_matrix_slice(   self.la,
                                            la_index_t(theRow),
                                            0,
                                            1,
                                            1,
                                            1,
                                            la_count_t(self.cols))
            return RMatrix(la: slice)
        }
    }
    

            let item = array[i]
            buffer[begin..<end] = item[0..<self.cols]
        }
        self.la = toLaObject(buffer, rows: self.rows, cols: self.cols)
    }
    
    init(array: [Double], rows: Int, cols: Int) {
        self.rows_ = rows
        self.cols_ = cols
        self.la = toLaObject(array, rows: self.rows, cols: self.cols)
    }
    
    init(value: Double, rows: Int, cols: Int) {
        self.rows_ = rows
        self.cols_ = cols
        let array = [Double](count: rows * cols, repeatedValue: value)
        self.la = toLaObject(array, rows: self.rows, cols: self.cols)
    }
    
    init(la: la_object_t) {
