Re: Symmetric Matrix Resize

"Peter J. Stieber" <[email protected]> Tue, 30 Oct 2007 09:23:16 -0700
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <[email protected]>
Peter J. Stieber wrote:
> MTL version: mtl-2.1.2-23.tenative
> Compiler: g++ (GCC) 4.1.2 20070925 (Red Hat 4.1.2-27)
> Platform: Fedora 7 x86_64
> =

> I'm trying to resize a symmetric matrix using a simple test jig called =

> SymmetricPackedResize.cpp ...
> =

> #include <mtl/mtl.h>
> =

> int main()
> {
>    typedef mtl::matrix<
>      double,
>      mtl::symmetric<mtl::lower>,
>      mtl::packed<> >::type TDSymmetricMatrix;
> =

>    TDSymmetricMatrix Symmetric(6, 6);
> =

>    Symmetric.resize(16, 16);
> =

>    return 0;
> }
> =

> I'm compiling with
> =

> g++ -IPathToMtlHeaders SymmetricPackedResize.cpp
> =

> The first set of errors I receive follow.  I've tried to separate them =

> onto different lines for readability:
> =

> mtl-2.1.2-23/mtl/dense2D.h: In member function =91void mtl::dense2D<T, =

> OffsetGen, MM, NN>::resize(typename mtl::generic_dense2D<std::vector<T, =

> std::allocator<_CharT> >, mtl::refcnt_ptr<std::vector<T, =

> std::allocator<_CharT> > >, OffsetGen, MM, NN>::size_type, typename =

> mtl::generic_dense2D<std::vector<T, std::allocator<_CharT> >, =

> mtl::refcnt_ptr<std::vector<T, std::allocator<_CharT> > >, OffsetGen, =

> MM, NN>::size_type) [with T =3D double, OffsetGen =3D =

> mtl::gen_packed_offset<0, 0>, int MM =3D 0, int NN =3D 0]=92:
> mtl-2.1.2-23/mtl/matrix_implementation.h:616:   instantiated from =91void =

> mtl::row_matrix<TwoDGen, IndexerGen>::resize(typename =

> mtl::matrix_implementation<TwoDGen, IndexerGen>::size_type, typename =

> mtl::matrix_implementation<TwoDGen, IndexerGen>::size_type) [with =

> TwoDGen =3D mtl::gen_dense2D<double, mtl::gen_packed_offset<0, 0>, 0, 0>, =

> IndexerGen =3D mtl::gen_banded_indexer<mtl::row_orien, 0, 0, long unsigne=
d =

> int>]=92
> =

> SymmetricPackedResize.cpp:12:   instantiated from here
> =

> mtl-2.1.2-23/mtl/dense2D.h:548: error: =91mtl::dimension<long unsigned =

> int, 0, 0> mtl::packed_offset<long unsigned int, 0, 0>::dim=92 is private
> =

> mtl-2.1.2-23/mtl/dense2D.h:1235: error: within this context
> =

> mtl-2.1.2-23/mtl/dense2D.h:1236: error: =91class mtl::packed_offset<long =

> unsigned int, 0, 0>=92 has no member named =91ld=92
> =

> So the packed_offset class has the dim data member declared private. =

> Looking at the rect_offset class for which resize actually works, there =

> is a suspicious commenting out for the private: scope qualifier ahead of =

> the data members.
> =

> I could do the same in packed_offset, but this would still leave me with =

> the "packed_offset<...> has no member named ld.  It looks like resize =

> will only work for rect_offset storage.
> =

> Does anyone see a workaround for this?
> =

> Peter, does version 4 deal with this?
> =

> How do I become an alpha tester of version 4?

Instead of explicitly setting the values of the offset class in the =

resize function, I changed the code to call a new resize member function =

of the offset class.  The following code implements resize for the =

rect_offset class by performing the same functionality that was in the =

dense2D class resize function.

   inline void resize(size_type m, size_type n)
   {
     dim =3D dim_type(m, n);
     ld =3D n;
   }

Now I need to add a resize function to the packed_offset class.  Here's =

my first cut...

   inline void resize(size_type m, size_type n)
   {
     dim =3D dim_type(m, n);
   }

but the packed_offset class has an addition data member called bw.  Can =

anyone explain the purpose of this data member so I can figure out if I =

need to alter it in packed_offset::resize?

Pete

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/