|
Ublas : |
Subject: Re: [ublas] Problems with identity_matrix<> / lu_substitute()
From: Pietro.Mele_at_[hidden]
Date: 2009-10-09 06:58:30
To: ublas mailing list <ublas@lists.boost.org>
From: Marco Guazzone <marco.guazzone@gmail.com>
Sent by: <ublas-bounces@lists.boost.org>
Date: 10/09/2009 08:06AM
Subject: Re: [ublas] Problems with identity_matrix<> / lu_substitute()
On Thu, Oct 8, 2009 at 8:03 PM, <Pietro.Mele@williamsf1.com> wrote:
> I have a problem compiling this code when instead of a numerical constant I
> use a variable or a const int as a size parameter to
> B(identity_matrix<float>(size)).
> And even when it compiles using the numerical value, it runs only with
> values in the 1-4 range. A 5 will make it crash (Floating exception).
>
> Thank you for your help.
>
> Pietro
>
>
> #include ...
> using namespace boost::numeric::ublas;
>
> int main()
> {
> int size = 4;
>
> // matrix<float> A(4, 4),
> B(identity_matrix<float>(4)); // OK with 1, 2, 3, 4.
> Crash with 5, 6, ... (Floating exception)
> matrix<float> A(size, size), B(identity_matrix<float>(size));
> // I will get a compile time error here ***, even if size is a const int
Try to use a vector instead of a matrix for B.
See the attached code for an example.
Compiled with GCC 4.4.1 + Boost 1.37:
$ g++ -Wall -Wextra -ansi -pedantic -o pietro pietro.cpp
No warning from compiler output.
Cheers,
-- Marco
_______________________________________________
ublas mailing list
ublas@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: pietro.mele@williamsf1.com