You can also overwrite eye

Could you elaborate on the "90% of the users won't be aware of these 
internal details in their day-to-day coding" part? If we ignore the name 
for a while, why is `I` not what you want here? It is as efficient as it 
can possibly be.

On Sunday, August 28, 2016 at 3:39:20 PM UTC-4, Júlio Hoffimann wrote:
>
> Hi,
>
> I wanna revive a discussion around the return type of eye(). Currently 
> this function always returns a dense matrix, which is not desired 
> considering that the identity acts as a simple scalar in every single place 
> it is used.
>
> By exploiting the type system, one would ideally write algorithms with 
> eye() and get specialized function calls for a "ConstantMatrix" type saving 
> memory and unnecessary calculations. People have raised the existence of 
> this variable "I" defined in Base that acts as identity, but I still think 
> that this is not robust given that 1) I can easily overwrite "I" in my user 
> code and 2) 90% of the users won't be aware of these internal details in 
> their day-to-day coding.
>
> Also, can someone explain what is the use of eye(m,n) with m != n? If that 
> case is relevant for some applications, I would still expect to get a 
> SparseMatrix instead.
>
> Can you please share your opinions on this matter?
>
> -Júlio
>
>
>

Reply via email to