예제 #1
0
    int BandMatrix::solve(int n, doublereal* b) {
        int info = 0;
        if (!m_factored) info = factor();
	if (info == 0)
	  ct_dgbtrs(ctlapack::NoTranspose, columns(), nSubDiagonals(), 
              nSuperDiagonals(), 1, DATA_PTR(ludata), ldim(), 
              DATA_PTR(ipiv()), b, columns(), info);

        // error handling
        if (info != 0) {
            ofstream fout("bandmatrix.csv");
            fout << *this << endl;
            fout.close();
        }
	return info;
    }
예제 #2
0
int BandMatrix::solve(doublereal* b, size_t nrhs, size_t ldb)
{
    int info = 0;
    if (!m_factored) {
        info = factor();
    }
    if (ldb == 0) {
        ldb = nColumns();
    }
    if (info == 0) {
        ct_dgbtrs(ctlapack::NoTranspose, nColumns(), nSubDiagonals(),
                  nSuperDiagonals(), nrhs, ludata.data(), ldim(),
                  ipiv().data(), b, ldb, info);
    }

    // error handling
    if (info != 0) {
        ofstream fout("bandmatrix.csv");
        fout << *this << endl;
    }
    return info;
}