Commit c4e27650 authored by Jan Möbius's avatar Jan Möbius
Browse files

More Uf_long replacements

parent 7f877a2d
Pipeline #494 passed with stage
......@@ -362,11 +362,11 @@ void cholmod_to_eigen( const cholmod_sparse& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j= P[i]; j< P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j= P[i]; j< P[i+1]; ++j)
//_A( I[j], i) += X[j]; // += really needed?
triplets.push_back( Triplet( I[j], i, X[j]));
}
......@@ -387,11 +387,11 @@ void cholmod_to_eigen( const cholmod_sparse& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j=P[i]; j<P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j=P[i]; j<P[i+1]; ++j)
{
//_A(I[j], i) += X[j];
triplets.push_back( Triplet( I[j], i, X[j]));
......@@ -451,8 +451,8 @@ void eigen_to_cholmod( const MatrixT& _A, cholmod_sparse* &_AC, cholmod_common*
if( _long_int) // long int version
{
std::vector<double> values;
std::vector<UF_long> rowind;
std::vector<UF_long> colptr;
std::vector<SuiteSparse_long> rowind;
std::vector<SuiteSparse_long> colptr;
// get data of gmm matrix
COMISO_EIGEN::get_ccs_symmetric_data( _A, uplo, values, rowind, colptr);
......@@ -461,14 +461,14 @@ void eigen_to_cholmod( const MatrixT& _A, cholmod_sparse* &_AC, cholmod_common*
_AC = cholmod_l_allocate_sparse(m,n,values.size(),true,true,_sparsity_type,CHOLMOD_REAL, _common);
// copy data to cholmod matrix
for(UF_long i=0; i<(UF_long)values.size(); ++i)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)values.size(); ++i)
{
((double*) (_AC->x))[i] = values[i];
((UF_long*)(_AC->i))[i] = rowind[i];
((SuiteSparse_long*)(_AC->i))[i] = rowind[i];
}
for(UF_long i=0; i<(UF_long)colptr.size(); ++i)
((UF_long*)(_AC->p))[i] = colptr[i];
for(SuiteSparse_long i=0; i<(SuiteSparse_long)colptr.size(); ++i)
((SuiteSparse_long*)(_AC->p))[i] = colptr[i];
}
else // int version
{
......@@ -523,11 +523,11 @@ void cholmod_to_eigen_dense( const cholmod_dense& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j= P[i]; j< P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j= P[i]; j< P[i+1]; ++j)
//_A( I[j], i) += X[j]; // += really needed?
triplets.push_back( Triplet( I[j], i, X[j]));
}
......@@ -548,11 +548,11 @@ void cholmod_to_eigen_dense( const cholmod_dense& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j=P[i]; j<P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j=P[i]; j<P[i+1]; ++j)
{
//_A(I[j], i) += X[j];
triplets.push_back( Triplet( I[j], i, X[j]));
......@@ -599,8 +599,8 @@ void eigen_to_cholmod_dense( const MatrixT& _A, cholmod_dense* &_AC, cholmod_com
if( _long_int) // long int version
{
std::vector<double> values;
std::vector<UF_long> rowind;
std::vector<UF_long> colptr;
std::vector<SuiteSparse_long> rowind;
std::vector<SuiteSparse_long> colptr;
// get data of gmm matrix
COMISO_EIGEN::get_ccs_symmetric_data( _A, uplo, values, rowind, colptr);
......@@ -609,14 +609,14 @@ void eigen_to_cholmod_dense( const MatrixT& _A, cholmod_dense* &_AC, cholmod_com
_AC = cholmod_l_allocate_sparse(m,n,values.size(),true,true,_sparsity_type,CHOLMOD_REAL, _common);
// copy data to cholmod matrix
for(UF_long i=0; i<(UF_long)values.size(); ++i)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)values.size(); ++i)
{
((double*) (_AC->x))[i] = values[i];
((UF_long*)(_AC->i))[i] = rowind[i];
((SuiteSparse_long*)(_AC->i))[i] = rowind[i];
}
for(UF_long i=0; i<(UF_long)colptr.size(); ++i)
((UF_long*)(_AC->p))[i] = colptr[i];
for(SuiteSparse_long i=0; i<(SuiteSparse_long)colptr.size(); ++i)
((SuiteSparse_long*)(_AC->p))[i] = colptr[i];
}
else // int version
{
......
......@@ -1151,11 +1151,11 @@ void cholmod_to_gmm( const cholmod_sparse& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j= P[i]; j< P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j= P[i]; j< P[i+1]; ++j)
_A( I[j], i) += X[j];
}
else
......@@ -1174,11 +1174,11 @@ void cholmod_to_gmm( const cholmod_sparse& _AC, MatrixT& _A)
// which integer type?
if(_AC.itype == CHOLMOD_LONG)
{
UF_long* P((UF_long*)_AC.p);
UF_long* I((UF_long*)_AC.i);
SuiteSparse_long* P((SuiteSparse_long*)_AC.p);
SuiteSparse_long* I((SuiteSparse_long*)_AC.i);
for(UF_long i=0; i<(UF_long)_AC.ncol; ++i)
for(UF_long j=P[i]; j<P[i+1]; ++j)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)_AC.ncol; ++i)
for(SuiteSparse_long j=P[i]; j<P[i+1]; ++j)
{
_A(I[j], i) += X[j];
......@@ -1235,8 +1235,8 @@ void gmm_to_cholmod( const MatrixT& _A, cholmod_sparse* &_AC, cholmod_common* _c
if( _long_int) // long int version
{
std::vector<double> values;
std::vector<UF_long> rowind;
std::vector<UF_long> colptr;
std::vector<SuiteSparse_long> rowind;
std::vector<SuiteSparse_long> colptr;
// get data of gmm matrix
COMISO_GMM::get_ccs_symmetric_data( _A, uplo, values, rowind, colptr);
......@@ -1245,14 +1245,14 @@ void gmm_to_cholmod( const MatrixT& _A, cholmod_sparse* &_AC, cholmod_common* _c
_AC = cholmod_l_allocate_sparse(m,n,values.size(),true,true,_sparsity_type,CHOLMOD_REAL, _common);
// copy data to cholmod matrix
for(UF_long i=0; i<(UF_long)values.size(); ++i)
for(SuiteSparse_long i=0; i<(SuiteSparse_long)values.size(); ++i)
{
((double*) (_AC->x))[i] = values[i];
((UF_long*)(_AC->i))[i] = rowind[i];
((SuiteSparse_long*)(_AC->i))[i] = rowind[i];
}
for(UF_long i=0; i<(UF_long)colptr.size(); ++i)
((UF_long*)(_AC->p))[i] = colptr[i];
for(SuiteSparse_long i=0; i<(SuiteSparse_long)colptr.size(); ++i)
((SuiteSparse_long*)(_AC->p))[i] = colptr[i];
}
else // int version
{
......
......@@ -138,7 +138,7 @@ factorize_system_gmm( const GMM_MatrixT& _A, GMM_MatrixT2& _Q, GMM_MatrixT3& _R,
// 2. factorize A -> Q,R,P
SuiteSparse_long econ = m;
cholmod_sparse *Q, *R;
// UF_long *P = new UF_long[n];
// SuiteSparse_long *P = new SuiteSparse_long[n];
SuiteSparse_long *P;
double rank = SuiteSparseQR<double>(ordering_, tolerance_, econ, AC, &Q, &R, &P, mp_cholmodCommon);
std::cerr << "factorization finished" << std::endl;
......@@ -165,16 +165,16 @@ factorize_system_gmm( const GMM_MatrixT& _A, GMM_MatrixT2& _Q, GMM_MatrixT3& _R,
//// [Q,R,E] = qr(A), returning Q as a sparse matrix
//template <typename Entry> UF_long SuiteSparseQR // returns rank(A) estimate
//template <typename Entry> SuiteSparse_long SuiteSparseQR // returns rank(A) estimate
//(
// int ordering, // all, except 3:given treated as 0:fixed
// double tol,
// UF_long econ,
// SuiteSparse_long econ,
// cholmod_sparse *A, // m-by-n sparse matrix
// // outputs
// cholmod_sparse **Q, // m-by-e sparse matrix where e=max(econ,rank(A))
// cholmod_sparse **R, // e-by-n sparse matrix
// UF_long **E, // permutation of 0:n-1, NULL if identity
// SuiteSparse_long **E, // permutation of 0:n-1, NULL if identity
// cholmod_common *cc // workspace and parameters
//) ;
......@@ -209,7 +209,7 @@ factorize_system_eigen( const Eigen_MatrixT& _A, Eigen_MatrixT& _Q, Eigen_Matrix
// 2. factorize A -> Q,R,P
SuiteSparse_long econ = m;
cholmod_sparse *Q, *R;
// UF_long *P = new UF_long[n];
// SuiteSparse_long *P = new SuiteSparse_long[n];
SuiteSparse_long *P;
double rank = SuiteSparseQR<double>(ordering_, tolerance_, econ, AC, &Q, &R, &P, mp_cholmodCommon);
std::cerr << "factorization finished" << std::endl;
......@@ -237,16 +237,16 @@ factorize_system_eigen( const Eigen_MatrixT& _A, Eigen_MatrixT& _Q, Eigen_Matrix
//// [Q,R,E] = qr(A), returning Q as a sparse matrix
//template <typename Entry> UF_long SuiteSparseQR // returns rank(A) estimate
//template <typename Entry> SuiteSparse_long SuiteSparseQR // returns rank(A) estimate
//(
// int ordering, // all, except 3:given treated as 0:fixed
// double tol,
// UF_long econ,
// SuiteSparse_long econ,
// cholmod_sparse *A, // m-by-n sparse matrix
// // outputs
// cholmod_sparse **Q, // m-by-e sparse matrix where e=max(econ,rank(A))
// cholmod_sparse **R, // e-by-n sparse matrix
// UF_long **E, // permutation of 0:n-1, NULL if identity
// SuiteSparse_long **E, // permutation of 0:n-1, NULL if identity
// cholmod_common *cc // workspace and parameters
//) ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment