<div style="font-family: arial, sans-serif; ">Hi, I'm trying to implement a matrix product example using DPH. This is the code:</div><div style="font-family: arial, sans-serif; "><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------------------------<br></div><div><div>type MMultType = Double</div><div>type Matrix = [:[:MMultType:]:]</div><div>type MVector = [:MMultType:]</div><div>type Matrix_wrapper = PArray (PArray MMultType)</div></div><div><br></div><div><div>{-# NOINLINE matMult_wrapper #-}</div><div>matMult_wrapper :: Matrix_wrapper -&gt; Matrix_wrapper -&gt; Matrix_wrapper</div><div>matMult_wrapper mA mB = toPArrayP (mapP toPArrayP (matMult (fromNestedPArrayP mA) (fromNestedPArrayP mB)))</div><div><br></div><div>matMult :: Matrix -&gt; Matrix -&gt; Matrix</div><div>matMult mA mB = mapP (\row -&gt; mapP (\col -&gt; dotp row col) (transposeP mB)) mA</div><div><br></div><div>dotp :: MVector -&gt; MVector -&gt; MMultType</div><div>dotp row col = D.sumP (zipWithP (D.*) row col)</div><div><br></div><div>transposeP :: Matrix -&gt; Matrix</div><div>transposeP m =&nbsp;</div><div>&nbsp; &nbsp; let</div><div>&nbsp; &nbsp; &nbsp; &nbsp; h = lengthP m</div><div>&nbsp; &nbsp; &nbsp; &nbsp; w = lengthP (m !: 0)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; rh = I.enumFromToP 0 (h I.- 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; rw = I.enumFromToP 0 (w I.- 1)</div><div>&nbsp; &nbsp; in</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if h I.== 0 then [: :]</div><div>&nbsp; &nbsp; &nbsp; &nbsp; else mapP (\y -&gt; mapP (\x -&gt; m !: x !: y) rh) rw</div></div><div>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>-------------------------</div></div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">My problem is at execution time, on matrices of size 300*300 the program does finish (although it is very slow), but on 700*700 it consumes GBs of RAM until the process is aborted.</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">In the paper "Work Efficient Higher-Order Vectorisation" it is explained that a work complexity problem (wich involved unnecesary array replication) was recently treated. So at first I thought the code implementation related to the paper had not been uploaded to hackage. But as I understand it must have been, as that seems to be the motive of the "dph-lifted-vseg" package.</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">Does anybody notice the problem with the example or if the problem is related to the subject treated in the paper?</div><div style="font-family: arial, sans-serif; "><br></div><div style="font-family: arial, sans-serif; ">Thanks in advance!</div>