Can someone please help me understand why I keep getting the error "Expected constructor, destructor, or type conversion before '.' token"? I've seen many variants of this error on other posts but none really seem to help me. I've included the important code fragments below. Let me know if more is needed. Thank you.
Code:
Code:
/*
Begin NRldlmain.cpp
*/
#include "nr3.h"
#include "sparse.h"
#include "NRldl.h"
//#include "interiorv1-N3-M3-K1.h"
int k=1;
doubleX_act[3]= {0.000000,0.957167,0.000000,};
int NV=3, N=NV;
int NC=3, M=NC;
NRsparseMatmy_A;
my_A.nrows = M; ** Error **
my_A.ncols = N; ** Error **
my_A.nvals = M*N; ** Error **
/*
Begin sparse.h
*/
structNRsparseMat//sparse matrix data structure for compressed column storage
{
Int nrows; //number of rows
Int ncols; //number of columns
Int nvals; //maximum number of nonzeros
VecInt col_ptr; //pointers to start of columns. length is ncols+1
VecInt row_ind; //row indices of nonzeros
VecDoub val; //array of nonzero values
NRsparseMat(); //default constructor
NRsparseMat(Int m,Int n,Int nnvals); //constructor. initializes vector to zero
VecDoub ax(constVecDoub &x) const; //multiply A by a vector x[0
ncols-1]
VecDoub atx(constVecDoub &x) const; //multiply A transpose by a vector x[0
nrows-1]
NRsparseMat transpose() const; //form A transpose
};
NRsparseMat::NRsparseMat() : nrows(0),ncols(0),nvals(0),col_ptr(),
row_ind(),val() {}
NRsparseMat::NRsparseMat(Int m,Int n,Int nnvals) : nrows(m),ncols(n),
nvals(nnvals),col_ptr(n+1,0),row_ind(nnvals,0),val(nnvals,0.0) {}