【问题标题】:Is a documentation of Blitz++ matrices available? [closed]是否有 Blitz++ 矩阵的文档可用? [关闭]
【发布时间】:2012-06-20 06:30:37
【问题描述】:

是否有关于 Blitz++ 矩阵的文档?

我在 google 上找到了http://www.oonumerics.org/blitz//manual/blitz01.html,但这似乎不包含文档。

我发现的唯一有用的例子是来自Rosettacode的这个例子:

#include <iostream>
#include <blitz/tinymat.h>

int main()
{
  using namespace blitz;

  TinyMatrix<double,3,3> A, B, C;

  A = 1, 2, 3,
      4, 5, 6,
      7, 8, 9;

  B = 1, 0, 0,
      0, 1, 0,
      0, 0, 1;

  C = product(A, B);

  std::cout << C << std::endl;
}

但是这个小例子并不能回答我的很多问题:

  • 是否存在类似 BigMatrix 的东西?
  • 如果我在编译时不知道矩阵的大小,如何创建矩阵?
  • 这些矩阵还支持哪些其他运算?

搜索 tinymat.h 显示此文件夹:

moose@pc07:/usr/include/blitz$ ls
applics.h      matbops.h     ops.h           tinyvec-et.h   vecglobs.h
array          matdiag.h     prettyprint.h   tinyvec.h      vecio.cc
array.h        matexpr.h     promote.h       tinyvecio.cc   veciter.h
array-impl.h   matgen.h      promote-old.h   tinyveciter.h  vecmax.cc
array-old.h    mathf2.h      rand-dunif.h    traversal.cc   vecmin.cc
bench.cc       mathfunc.h    rand-mt.h       traversal.h    vecnorm1.cc
benchext.cc    matltri.h     rand-normal.h   tuning.h       vecnorm.cc
benchext.h     matref.h      random.h        tvcross.h      vecpick.cc
bench.h        matrix.cc     randref.h       tvecglobs.h    vecpick.h
blitz.h        matrix.h      rand-tt800.h    update.h       vecpickio.cc
bzconfig.h     matsymm.h     rand-uniform.h  vecaccum.cc    vecpickiter.h
bzdebug.h      mattoep.h     range.h         vecall.cc      vecsum.cc
compiler.h     matuops.h     reduce.h        vecany.cc      vector.cc
config.h       matutri.h     shapecheck.h    vecbfn.cc      vector-et.h
etbase.h       memblock.cc   tau.h           vecbops.cc     vector.h
extremum.h     memblock.h    timer.h         veccount.cc    vecuops.cc
funcs.h        meta          tiny.h          vecdelta.cc    vecwhere.cc
gnu            minmax.h      tinymatexpr.h   vecdot.cc      vecwhere.h
indexexpr.h    mstruct.h     tinymat.h       vecexpr.h      wrap-climits.h
limits-hack.h  numinquire.h  tinymatio.cc    vecexprwrap.h  zero.cc
listinit.h     numtrait.h    tinyvec.cc      vecglobs.cc    zero.h

所以我猜Matrix 适用于更大的矩阵。但是我如何将它们相乘?此外,这不是我了解图书馆的首选方式。

我已经安装了libblitz-doc - C++ template class library for scientific computing,所以文档应该在我的电脑上。但是我必须在哪里搜索?

【问题讨论】:

    标签: documentation matrix-multiplication blitz++


    【解决方案1】:

    www.oonumerics.org 网站目前似乎已损坏。但是,Blitz 的完整文档包含在软件包中,可以从 SourceForge 上的this link 下载。

    在 Blitz 中没有像 BigMatrix 这样的特殊类。矩阵只是一个二维数组,所以使用Array 模板。您不必在编译时知道数组/矩阵的大小。这是文档中的一个小示例:

    #include <blitz/array.h>
    
    using namespace blitz;
    
    int main()
    {
        Array<int,2> A(6,6), B(3,3);
    
        // Set the upper left quadrant of A to 5 
        A(Range(0,2), Range(0,2)) = 5; 
    
        // Set the upper right quadrant of A to an identity matrix
        B = 1, 0, 0,
            0, 1, 0,
            0, 0, 1;
        A(Range(0,2), Range(3,5)) = B;
    
        // Set the fourth row to 1
        A(3, Range::all()) = 1;
    
        // Set the last two rows to 0
        A(Range(4, Range::toEnd), Range::all()) = 0;
    
        // Set the bottom right element to 8
        A(5,5) = 8;
    
        cout << "A = " << A << endl;
    
        return 0;
    }
    

    如果您使用基于 Debian 的发行版,dpkg -L libblitz-doc 将显示 libblitz-doc 软件包的内容,您可以看到文档所在的位置。在我的机器上,它们位于/usr/share/doc/libblitz-doc/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-26
      • 1970-01-01
      • 2011-06-17
      • 1970-01-01
      • 2017-07-04
      • 1970-01-01
      • 2019-10-17
      • 2012-11-28
      相关资源
      最近更新 更多