Closed sarkar1 closed 8 years ago
X'[:,1] creates a one-dimensional array so you have theta (which is 2D) subtracting a 1D array. Julia automatically broadcasts this 1D array to 2D in order to do this element-wise subtraction. ParallelAccelerator doesn't currently support this.
You can change your example to X'[:,1:1] in order to create a 2D array and then this example seems to work.
Thanks @DrTodd13. I am aware of this issue and wanted to point it out. Maybe its not a priority right now.
At the moment, it is difficult for us to mimic Julia's broadcast semantics for when there is dimensional mismatch. We don't really plan on trying to fix this for 0.4 especially because there is an easy source fix such as using "1:1" instead of "1". If semantics become easier for us in 0.5 it would be nice to do it but like you say not a priority.
So, given that, what would you like to see as a result of this ticket? Is it a complaint that the error message isn't helpful enough? About the best we could easily do there is to say what kind of operation involved arrays of differing dimensionality. I could print the array name but in this particular case it is a temporary array name (a GenSym) that would not have any obvious correlation to something in the program. I could change the message to be a bit clearer that it is a dimensional mismatch between two arrays involved in some operation and I could print the dimensions that don't match as well.
It is actually a warning message. Both (1:1 and 1) gives the same result. I think the warning message you suggested is great. This looks good for now. I am closing this ticket.
Julia executes the following code without warning however ParallelAccelerator throws the given message.