Talk:Element-wise operations: Difference between revisions

From Rosetta Code
Content added Content deleted
(What fetish?)
No edit summary
Line 7: Line 7:


:Hi Ledrug. What fetish? The goal of the site is language comparison although some of the algorithms shown ''are'' used in serious work. Not every language will have a matrix library. Not every program will warrent the use of a library for handling matrices. Implementing your own matrix routines is not always a bad idea. A vector, (1d), is not a matrix, (2d); and different considerations may come into play. Maybe it would help if you explained a bit more, or lurked a bit more to get a better idea of what RC and the community are trying to achieve? --[[User:Paddy3118|Paddy3118]] 23:23, 9 June 2011 (UTC)
:Hi Ledrug. What fetish? The goal of the site is language comparison although some of the algorithms shown ''are'' used in serious work. Not every language will have a matrix library. Not every program will warrent the use of a library for handling matrices. Implementing your own matrix routines is not always a bad idea. A vector, (1d), is not a matrix, (2d); and different considerations may come into play. Maybe it would help if you explained a bit more, or lurked a bit more to get a better idea of what RC and the community are trying to achieve? --[[User:Paddy3118|Paddy3118]] 23:23, 9 June 2011 (UTC)

:If the point of this task is to demonstrate how to work with matrices, there are already multiple other tasks doing just that. If it's to show how to iterate through an array and do something to each element, a vector suffices and would make the relevant part easier to see (and there are already multiple other tasks doing just that). Basically, how is this task not a duplicate of effort, and why does it have to be more complicated than necessary if it's just to show language features? --[[User:Ledrug|Ledrug]] 23:50, 9 June 2011 (UTC)

Revision as of 23:50, 9 June 2011

Can we cut back on the matrix fetish? If you need it for serious work, go get a good quality matrix library for your language. Implementing your own matrix class is always a bad idea. The task could have said "vector", which is a lot simpler to write a short clean implementation for and much more to the point.

And the task with the Lisp example is lousy. Do you check if the dimensions match? Can you even tell if the object is indeed a matrix? If the dimensions are wrong, does it just blow up or silently give some undefined answer? -- Ledrug 18:57, 9 June 2011 (UTC)

It may be fine for educational purposes as long as we add a disclaimer saying that this is probably not the best way to do things in most languages (although we already have a disclaimer here that says code here shouldn't be used for so called "serious work"). This task is probably pretty much perfect for array programming languages like APL and J. --Mwn3d 20:54, 9 June 2011 (UTC)
I'm not worried about someone mistakenly using any code for mission critical job, but rather that choosing matrix as the subject here is suboptimal. The task basically wants to demonstrate operator overloading, and using a 1-D vector is good enough to show it--in fact better, because there would be less cruft involved. It's also questionable if it illustrates anything for a real matrix-oriented environment: in Matlab, you do element-wise multiplication between matrices by "a = b .* c", which is rather boring. And how is this task really unique from all the other existing matrix-related tasks on this site? --Ledrug 21:52, 9 June 2011 (UTC)
We do "suboptimal" tasks all the time (e.g. Sorting algorithms/Bogosort, and Arithmetic/Complex and Stack probably fit your third-party library argument). The point here isn't necessarily to have useful/the best code examples (though it does happen sometimes). The point is to compare languages. Just because something is boring in one language doesn't preclude it from being interesting to show in all other languages or using user-generated code (see Factorial#J). Operator overloading is not the only route to go here. Basically any mathematical task we have here that takes arguments could be done as an operator (as long as you choose a symbol). This task wants to see the language idioms related to particular matrix operations should a user decide to implement them himself. Sometimes there is hidden value in these academic exercises (which is probably why they choose to use some of them in academia). --Mwn3d 22:20, 9 June 2011 (UTC)
Hi Ledrug. What fetish? The goal of the site is language comparison although some of the algorithms shown are used in serious work. Not every language will have a matrix library. Not every program will warrent the use of a library for handling matrices. Implementing your own matrix routines is not always a bad idea. A vector, (1d), is not a matrix, (2d); and different considerations may come into play. Maybe it would help if you explained a bit more, or lurked a bit more to get a better idea of what RC and the community are trying to achieve? --Paddy3118 23:23, 9 June 2011 (UTC)
If the point of this task is to demonstrate how to work with matrices, there are already multiple other tasks doing just that. If it's to show how to iterate through an array and do something to each element, a vector suffices and would make the relevant part easier to see (and there are already multiple other tasks doing just that). Basically, how is this task not a duplicate of effort, and why does it have to be more complicated than necessary if it's just to show language features? --Ledrug 23:50, 9 June 2011 (UTC)