Giter Site home page Giter Site logo

Boolean Indexing support ? about matft HOT 4 CLOSED

jjjkkkjjj avatar jjjkkkjjj commented on May 23, 2024
Boolean Indexing support ?

from matft.

Comments (4)

jjjkkkjjj avatar jjjkkkjjj commented on May 23, 2024 1

Unfortunately Boolean indexing (and fancy indexing) has not been supported yet in Matft.
But fortunately, I found vdsp function to achieve them.

So Iโ€™ll try to implement them! So could you wait for a moment?

And the reason of low performance in element-wise operation is n-dimensional arrayโ€™s data structure. Therefore, for-loop operations in n-dimensional array such like Matft and numpy tend to be slow.
So, please convert into Swift Array by toArray() until I implement them;

var bar = MfArray(testing, shape: [400,400])
let swiftArray = bar.toArray()  as! [[Int]]
for i in 0..<400 {
    for j in 0..<400 {
        bar[i][j] = bar[i][j] + 1
    }
}

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 23, 2024 1

@Ykid
I've implemented Boolean Indexing!! (but i do not check performance...)
Anyway, you can assign values with boolean like this;

let img = MfArray([[1, 2, 3],
                               [4, 5, 6],
                               [7, 8, 9]], mftype: .UInt8)
img[img > 3] = MfArray([10], mftype: .UInt8)
print(img)
/*
mfarray = 
[[	1,		2,		3],
[	10,		10,		10],
[	10,		10,		10]], type=UInt8, shape=[3, 3]
*/

from matft.

Ykid avatar Ykid commented on May 23, 2024 1

Great thanks ! Let me verify it these days

from matft.

Ykid avatar Ykid commented on May 23, 2024 1

@jjjkkkjjj The implementation is pretty fast ! ๐Ÿ‘

from matft.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.