Multiplying transposed matrices in mir

p.shkadzko p.shkadzko at gmail.com
Sun Apr 19 19:20:28 UTC 2020


On Sunday, 19 April 2020 at 19:13:14 UTC, p.shkadzko wrote:
> On Sunday, 19 April 2020 at 18:59:00 UTC, jmh530 wrote:
>> On Sunday, 19 April 2020 at 17:55:06 UTC, p.shkadzko wrote:
>>> snip
>>>
>>> So, lubeck mtimes is equivalent to NumPy 
>>> "a.dot(a.transpose())".
>>
>> There are elementwise operation on two matrices of the same 
>> size and then there is matrix multiplication. Two different 
>> things. You had initially said using an mxn matrix to do the 
>> calculation. Elementwise multiplication only works for 
>> matrices of the same size, which is only true in your 
>> transpose case when they are square. The mtimes function is 
>> like dot or @ in python and does real matrix multiplication, 
>> which works for generic mxn matrices. If you want elementwise 
>> multiplication of a square matrix and it’s transpose in mir, 
>> then I believe you need to call assumeContiguous after 
>> transposed.
>
> "assumeContiguous" that's what I was looking for. Thanks!

well no, "assumeContiguous" reverts the results of the 
"transposed" and it's "a * a".
I would expect it to stay transposed as NumPy does "assert 
np.all(np.ascontiguous(a.T) == a.T)".




More information about the Digitalmars-d-learn mailing list