Opened 7 years ago

#11293 new Bugs

Matrix Memory problem after using lu_factorize

Reported by: michael.cortis@… Owned by: Gunter
Milestone: To Be Determined Component: uBLAS
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Discovered that after using lu_factorize the values of the matrix have changed!

#include <iostream>

#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/lu.hpp>

using namespace std;
using namespace boost::numeric;

int main()
{
  ublas::matrix<double> X(3,3); X.clear();
  X(0,0) = 0.995182407377577; X(0,1) =-0.006473367705848; X(0,2) =-0.002032391957706;
  X(1,0) =-0.006473367705848; X(1,1) = 0.995182407377577; X(1,2) =-0.002032391957706;
  X(2,0) =-0.002032391957706; X(2,1) =-0.002032391957706; X(2,2) = 0.936175146339137;
  cout<<setprecision(16)<<X<<endl;
  cout<<ublas::lu_factorize(X)<<endl;
  cout<<setprecision(16)<<X<<endl;
  cout<<ublas::lu_factorize(X)<<endl;
  cout<<setprecision(16)<<X<<endl;
}

Output:

[3,3]((0.995182407377577,-0.006473367705848,-0.002032391957706),(-0.006473367705848,0.995182407377577,-0.002032391957706),(-0.002032391957706,-0.002032391957706,0.936175146339137))
0
[3,3]((0.995182407377577,-0.006473367705848,-0.002032391957706),(-0.006504704723334175,0.9951403000320849,-0.002045612067272957),(-0.002042230592742885,-0.002055601674665375,0.9361667907625133))
0
[3,3]((0.995182407377577,-0.006473367705848,-0.002032391957706),(-0.006536193440632496,0.9950979888485471,-0.002058896174255709),(-0.002052116855767581,-0.002079077442455779,0.9361583394521271))

Is this fixed in newer versions?

Thanks

Michael Cortis

RA, Durham University

Change History (0)

Note: See TracTickets for help on using tickets.