Giter Site home page Giter Site logo

Add fancy indexing about matft HOT 10 CLOSED

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024
Add fancy indexing

from matft.

Comments (10)

ALMerrill avatar ALMerrill commented on May 25, 2024 1

That would be awesome! Whenever you can would be great

from matft.

ALMerrill avatar ALMerrill commented on May 25, 2024 1

Nice! That's awesome!

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

@ALMerrill
I'd like to implement "fancy indexing", of course.
OK, I'll try to do it on this weekend, but don't expect me excessively! šŸ˜…

from matft.

ALMerrill avatar ALMerrill commented on May 25, 2024

Also, out of curiosity, is there a way to improve performance with the Boolean indexing? With how Iā€™m using it, it looks like things like array > someNumber is taking the majority of the time. I was just curious if you knew of any way to improve performance on calls like that. Thanks so much!

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

it looks like things like array > someNumber is taking the majority of the time.

Yes, your point is correct. The code to improve performance may be here firstly. I think there are much redundant process in this code. So, i should simplify this code.

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

Or use boolean as storedType as you pointed out, but this will change many codes...

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

Official code is here; https://github.com/numpy/numpy/blob/cf1306a842d7b1064270bd06951a485121e60816/numpy/core/src/multiarray/mapping.c#L1608

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

@ALMerrill
I implemented fancy indexing getter!
You can try it by fetching develop branch.
You can pass Int MfArray instead of list to MfArray like this;

let a = MfArray([[1, 2], [3, 4], [5, 6]])
a[MfArray([0, 1, 2]), MfArray([0, 1, 0])]
/*
mfarray = 
[	1,		4,		5], type=Int, shape=[3]
*/

numpy;

>>> x = np.array([[1, 2], [3, 4], [5, 6]])
>>> x[[0, 1, 2], [0, 1, 0]]
array([1, 4, 5])

I don't know if I can implement setter...

from matft.

ALMerrill avatar ALMerrill commented on May 25, 2024

awesome, thank you for the update!

from matft.

jjjkkkjjj avatar jjjkkkjjj commented on May 25, 2024

@ALMerrill
I've just implemented fancy setter!!
I didn't check performance, but anyway you can use fancy indexing for MfArrayšŸŽ‰

Setter;

let a = MfArray([[1, 2], [3, 4], [5, 6]])
            
a[MfArray([0, 1, 2]), MfArray([0, -1, 0])] = MfArray([999,888,777])
print(a)
/*
mfarray = 
[[	999,		2],
[	3,		888],
[	777,		6]], type=Int, shape=[3, 2]
*/
            
a.T[MfArray([0, 1, -1]), MfArray([0, 1, 0])] = MfArray([-999,-888,-777])
print(a)
/*
mfarray = 
[[	-999,		-777],
[	3,		-888],
[	777,		6]], type=Int, shape=[3, 2]
*/

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.