【发布时间】:2018-08-22 01:55:51
【问题描述】:
我一直在从事一个使用列表来计算人工神经网络操作的项目。现在,我想将其转换为Data.Vector 以提高其效率。但是,我目前在实现Foreign.Storable 以获得必要的定义时遇到了麻烦。
好的,首先,我使用Data.Array.Repa 进行计算,其类型同义词如下 (CAMTypes.hs):
type NTTVU = Array U VShape NTT
后来我想用Data.Vector如下:
import qualified Data.Vector.Storable as VS
-- ...
trs = createThreshold 3 0 [9,8,7] :: NTTVU
但是,我收到以下错误:
$> VS.singleton trs
*** Exception: Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at ./Data/Vector/Storable/Mutable.hs:131:22 in vector-0.12.0.1-JlawpRjIcMJIYPJVsWriIA:Data.Vector.Storable.Mutable
CallStack (from -prof):
Data.Vector.Storable.Mutable.basicUnsafeNew.size (Data/Vector/Storable/Mutable.hs:131:7-36)
Data.Vector.Storable.Mutable.basicUnsafeNew (Data/Vector/Storable/Mutable.hs:(124,3)-(132,38))
Data.Vector.Storable.Mutable.CAF:lvl12_r7YZK (<no location info>)
我已经完成了instance Storable NTTVU where 的实现,但仍然抱怨;我启用了分析,但没有告诉我更多信息;尝试按步骤调试,但也没有成功。希望有人知道很多关于它以及如何解决它。
更多上下文,the whole project,以及相关文件:
【问题讨论】:
标签: haskell vector repa storable