【24h】

Processing Sparse Vectors During Compile Time in C++

机译:在C ++中的编译期间处理稀疏向量

获取原文
获取原文并翻译 | 示例

摘要

A C++ template library for a special class of sparse vectors is outlined. The sparseness structure of these vectors can be arbitrary but must be known at compile time. In this case it suffices to store only the nonzero elements of the vectors, and no indexing information about the sparseness pattern is required. This information is contained in the type of the vector as a non-type template parameter. It is shown how common vector operators can be overloaded for these vectors. When compiled the operators yield code which performs only the necessary elementary operations between the nonzero elements with no run-time penalty for indexing. All indexing is performed at compile time, resulting in very fast execution speed. The vector classes are best suited for short vectors up to few dozens of elements.
机译:概述了用于特殊类的稀疏向量的C ++模板库。这些向量的稀疏结构可以是任意的,但必须在编译时知道。在这种情况下,仅存储向量的非零元素就足够了,并且不需要有关稀疏模式的索引信息。该信息作为非类型模板参数包含在向量的类型中。显示了如何对这些向量重载常见的向量运算符。编译时,运算符会产生代码,该代码仅在非零元素之间执行必要的基本运算,而不会为索引造成运行时间损失。所有索引都在编译时执行,因此执行速度非常快。向量类最适合短向量(最多几十个元素)。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号