:repaを使用しているときに、mmultPでIDモナドを使用すると何が問題になりますか?
import Data.Array.Repa
import Data.Array.Repa.Algorithms.Matrix
import Data.Functor.Identity
go = runIdentity $ do
let mat = fromListUnboxed (ix2 2 2) [1..4]
let ins = fromListUnboxed (ix2 2 1) [1, 1]
mmultP mat ins
は私に次の警告与えている:
Data.Array.Repa: Performing nested parallel computation sequentially.
You've probably called the 'compute' or 'copy' function while another
instance was already running. This can happen if the second version
was suspended due to lazy evaluation. Use 'deepSeqArray' to ensure
that each array is fully evaluated before you 'compute' the next one.
を私はネストされた計算を持っていない、私はcompute
かcopy
を呼び出して、すべてのものはなかったです私が計算をしていたのは、同じモナドの中にあります。それは怠惰な評価とは何か?そうであれば、アイデンティティモナドを使用して並列計算を行う(全体の計算を純粋に保つために)方法を教えてください。
runIdentity
をrunST
に置き換えると、いずれの場合も特定のモナドの機能がまったく使用されていませんが、どちらの場合でも動作します。
、私が見ます'mmultP'は' unsafePerformIO'を呼び出す 'computeP'を呼び出します。私はそれほど経験はありませんが、 'unsafePerformIO'と' Identity'モナド(おそらく 'Identity'の怠惰との動作)の間に互換性がないかもしれませんか? – madjar
@madjarわかりません。私はどのように表示されません。 – rityzmon