Boost logo

Boost Users :

Subject: Re: [Boost-users] complex matrix operations
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-08-31 10:51:49


On 08/31/11 08:04, sairamesh raghuraman wrote:
> Hello,
>
> I am looking for a C++ library that has routines for a variety of
> complex matrix decompositions (eigen, cholesky, singular value etc) and
> even complex matrix inverse, principal matrix logarthm of a complex
> matrix etc. And the matrices which I am talking are pretty huge..can go
> upto 1024 x 1024 x 32.
>
> I have already found a library that can do all of the above..used it..it
> works fine..but a disadvantage is that it cannot handle multidimensional
> arrays. Now the question is, does Boost C++ library have functions for
> the above?
>
> Looking forward to a reply and thanks in advance
>
> Ramesh
>
Hi Ramesh,

I'm not a multi_array expert, but I would guess that multi_array views:

http://www.boost.org/doc/libs/1_47_0/libs/multi_array/doc/user.html#sec_views

could be used to return a 1020 x 1024 view of your 1024 x 1024 x 32
array, and that view could be passed to whatever you're now using to
do the matrix decompositions. To be more concrete (an copy/pasting from
the above user.html#sec_views and:

http://www.boost.org/doc/libs/1_47_0/libs/multi_array/doc/user.html#sec_example

):

  // Create a 3D array that is 1024 x 1024 x 3
  typedef boost::multi_array<double, 3> array_type;
  typedef array_type::index index;
  array_type myarray(boost::extents[1024][1024][3]);

  typedef boost::multi_array_types::index_range range;
  array_type::index_gen indices;
  unsigned const index3=0;//or 1 or 2
  array_type::array_view<2>::type myview =
    myarray[ indices[range(0,1024)][range(0,1024)][index3] ];

  for (array_type::index i = 0; i != 1024; ++i)
    for (array_type::index j = 0; j != 1024; ++j)
      assert(myview[i][j] == myarray[i][1][index3]);

Then I guess myview could be passed to whatever existing
matrix decomposition functions you have; however, I've
not even compiled the above code.

HTH

-Larry


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net