Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Shape after "ufuncReduce add" #21

Closed
mlajtos opened this issue Aug 7, 2021 · 5 comments
Closed

Wrong Shape after "ufuncReduce add" #21

mlajtos opened this issue Aug 7, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@mlajtos
Copy link

mlajtos commented Aug 7, 2021

Hello,

I think there is a bug in ufuncReduce. This code

Matft.ufuncReduce(mfarray: MfArray([1,2,3,4,5,6,7,8,9,10] as [Double]), ufunc: Matft.add)

returns

MfArray([55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

I would expect that I would get scalar or array of shape [1]. What am I doing wrong please?

@jjjkkkjjj
Copy link
Owner

Thanks! That's a bug!
I'll fix it.

@jjjkkkjjj
Copy link
Owner

jjjkkkjjj commented Aug 9, 2021

@mlajtos
Did you update the latest version?
I couldn't reproduce this bug. I got correct MfArray in the latest version like this;

print(Matft.ufuncReduce(mfarray: MfArray([1,2,3,4,5,6,7,8,9,10] as [Double]), ufunc: Matft.add))
//mfarray = 
//[	55.0], type=Double, shape=[1]

@mlajtos
Copy link
Author

mlajtos commented Aug 9, 2021

I am on 0.2.9. Running it inside playground I get this:

Snímka obrazovky 2021-08-09 o 11 07 50

However, the MfArray seems correct, so it is a bug inside toArray method.

Snímka obrazovky 2021-08-09 o 11 09 20

jjjkkkjjj pushed a commit that referenced this issue Aug 9, 2021
#21
# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Mon Aug 9 22:15:57 2021 +0900
#
# interactive rebase in progress; onto 67aa73a
# Last command done (1 command done):
#    edit 01c8fb1 fixed #21
# No commands remaining.
# You are currently editing a commit while rebasing branch 'master' on '67aa73a'.
#
# Changes to be committed:
#	new file:   Matft.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
#	modified:   Sources/Matft/util/common/order.swift
#	modified:   Sources/Matft/util/library/vDSP.swift
#	modified:   Tests/MatftTests/ConversionTest.swift
#
@jjjkkkjjj
Copy link
Owner

@mlajtos
I could reproduce this bug and I've just fixed it.
Your point was correct. Add(binary operation function) seemed to cause this bug.
Could you update the latest commit and check this bug again?

@mlajtos
Copy link
Author

mlajtos commented Aug 9, 2021

@jjjkkkjjj I just tried master and it works as expected. Thank you, that was really fast. :)

IMG_1731

@jjjkkkjjj jjjkkkjjj added the bug Something isn't working label Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants