← Back to team overview

dolfin team mailing list archive

[Bug 41] New: Matrix class assignment option is not working

 

http://www.fenics.org/cgi-bin/bugzilla/show_bug.cgi?id=41

           Summary: Matrix class assignment option is not working
           Product: DOLFIN
           Version: development version
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: features
        AssignedTo: dolfin-dev@xxxxxxxxxx
        ReportedBy: hmonajem@xxxxxxxxxxxxxxxxxxx


Hi
Isn't this code supposed to work? It gives me "invalid lvalue in 
assignment" error while compiling. How should I assign the elements of 
a Matrix???

//-------------------------------
int main()
{


for(i=0; i<nens; i++)
.
.
.
real* values = new real[nstat];
u1.interpolate(values);

Matrix S(nstat,nens);

for(int j=0;j<nstat;j++)
  {
    S(j,i)=values[j];
  }

}

answer from Anders logg:
Sorry, this doesn't work yet.

We can easily fix this in the GenericMatrix interface by adding an
auxiliary class MatrixEntry (which just holds (i, j) and a reference
to the matrix) and have operator() return that, then overload
operator= in MatrixEntry to assign to the matrix.

We had this in DOLFIN 2-3 years back but the linear algebra has gone
through several reimplementations since then...

Until this has been implemented, you can use the setitem() function.

And please file a bug report for this. Mark it as "enhancement".

-- 
Anders


-- 
Configure bugmail: http://www.fenics.org/cgi-bin/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.