|
Ublas : |
Subject: Re: [ublas] Errors using coordinate_matrix
From: Kurt Reidinger (aldertonkayaks_at_[hidden])
Date: 2011-12-02 16:02:05
But the following seems to work(?) - Kurt Reidinger
//
// Testing.cpp : run on Vista x64/VS 2008/Boost 1.47.0
//
//
// Behavior:
// Contents of A:
// [5,5]((2,3,0,0,0),(3,0,4,0,6),(0,-1,-3,2,0),(0,0,1,0,0),(0,4,2,0,1))
// Contents of B:
// [5,5]((2,3,0,0,0),(3,0,4,0,6),(0,-1,-3,2,0),(0,0,1,0,0),(0,4,2,0,1))
// Press any key to continue . . .
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define _SCL_SECURE_NO_WARNINGS
#include <tchar.h>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix_sparse.hpp>
using namespace boost::numeric::ublas;
int _tmain(int argc, _TCHAR* argv[])
{
coordinate_matrix<double> A(5, 5, 12);
matrix<double> B(5, 5);
// Uncomment for error
A(0, 0) = 2.;
// Rest of entries ...
A(0, 1) = 3;
A(1, 0) = 3.;
A(1, 2) = 4.;
A(1, 4) = 6;
A(2, 1) = -1.;
A(2, 2) = -3.;
A(2, 3) = 2.;
A(3, 2) = 1.;
A(4, 1) = 4.;
A(4, 2) = 2.;
A(4, 4) = 1.;
std::cout << "Contents of A:" << std::endl;
std::cout << A << std::endl;
B = A;
std::cout << "Contents of B:" << std::endl;
std::cout << B << std::endl;
return 0;
}
On Thu, Dec 1, 2011 at 12:40 AM, Rutger ter Borg <rutger_at_[hidden]> wrote:
> On 2011-11-30 18:35, Bruno Abreu Calfa wrote:
>
>> Hello,
>>
>> I have been getting compiling errors when using coordinate_matrix. For
>> example:
>>
>
> Hello Bruno,
>
> I've reduced your error to
>
>
> #include <boost/numeric/ublas/matrix_**sparse.hpp>
>
>
> using namespace boost::numeric::ublas;
>
> int main(int argc, char* argv[])
>
> {
> coordinate_matrix<double> A(5, 5, 12);
>
> // Uncomment for error
> //A(0, 0) = 2.;
>
> return 0;
> }
>
> so I guess it's not related to the bindings.
>
> Cheers,
>
> Rutger
>
>
> ______________________________**_________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/**mailman/listinfo.cgi/ublas
> Sent to: aldertonkayaks_at_[hidden]
>