jjjkkkjjj / Matft

Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vector library)
BSD 3-Clause "New" or "Revised" License
134 stars 21 forks source link

[Fatal error] Subscription of view MfArray #9

Closed jjjkkkjjj closed 4 years ago

jjjkkkjjj commented 4 years ago

Fatal error was occurred... I think this was caused by extracting view's base directly.

let a = Matft.mfarray.arange(start: 0, to: 27*2, by: 2, shape: [3,3,3], mftype: .Double, mforder: .Column)

            XCTAssertEqual(a[~-1], MfArray([[[ 0, 18, 36],
                                             [ 6, 24, 42],
                                             [12, 30, 48]],

                                            [[ 2, 20, 38],
                                             [ 8, 26, 44],
                                             [14, 32, 50]]], mftype: .Double))
            let b = a[~-1]

            XCTAssertEqual(b[~1, ~2], MfArray([[[18, 19, 20],
                                                [21, 22, 23]]], mftype: .Double)) >>>>>>>>Not equal!!

            XCTAssertEqual(b[0], MfArray([[18, 19, 20],
                                          [21, 22, 23],
                                          [24, 25, 26]], mftype: .Double))  >>>>>>>>Not equal!!