문제

Is a documentation of Blitz++ matrices available?

I found http://www.oonumerics.org/blitz//manual/blitz01.html with google, but this seems not to contain the documentation.

The only useful example I found is this one from 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;
}

But this small example doesn't answer many of my questions:

  • Does something like BigMatrix exist?
  • How can I create matrices when I don't know their size at compile time?
  • Which other operations do these matrices support?

A search for tinymat.h revealed this folder:

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

So I guess Matrix is for bigger matrices. But how do I multiply them? Additionally, this is not my preferred way to learn something about a library.

I have libblitz-doc - C++ template class library for scientific computing installed, so the documentation should be on my computer. But where do I have to search?

도움이 되었습니까?

해결책

The www.oonumerics.org website seems to be broken at the moment. However the full documentation for Blitz is included with the package which can be downloaded from this link on SourceForge.

In Blitz there is no special class like BigMatrix. Matrix is just a two-dimensional array, so use the Array template. You don't have to know the size of an array/matrix at compile time. Here's a small example from the docs:

#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;
}

If you are using Debian-based distribution, dpkg -L libblitz-doc will reveal the content of the libblitz-doc package and you could see where the docs are located. On my machine they are in /usr/share/doc/libblitz-doc/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top