Comments (4)
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.
@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.
Great thanks ! Let me verify it these days
from matft.
@jjjkkkjjj The implementation is pretty fast !
from matft.
Related Issues (20)
- Boolean Indexing is slow HOT 10
- Other Cubic spline Interpolation
- not found np.unique() HOT 1
- Wrong Shape after "ufuncReduce add" HOT 5
- Matft.math.pow is not working as expected HOT 1
- Add @inline
- Complex support HOT 9
- Refactoring pointer HOT 3
- Adding demo for image processing HOT 3
- Support for atan2 HOT 3
- Feature Request: Numpy Dot HOT 1
- Image processing HOT 5
- Multidimensional MfArray with different length Arrays in axis 1 HOT 2
- Copy On Write implementation HOT 2
- Subscript bug using `Matft.arange()` HOT 4
- Numpy FFT implementation? HOT 11
- Support MLMultiArray HOT 1
- [Bug] Invalid access on some complex operation
- How to contribute - have some small numpy / scipy vDSP implementations HOT 1
- How to get the content of the MfArray? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matft.