25 BandMatrix::BandMatrix() :
45 data.resize(n*(2*kl + ku + 1));
46 ludata.resize(n*(2*kl + ku + 1));
51 size_t ldab = (2*kl + ku + 1);
52 for (
size_t j = 0; j < n; j++) {
74 for (
size_t j = 0; j <
m_n; j++) {
99 for (
size_t j = 0; j <
m_n; j++) {
110 data.resize(n*(2*kl + ku + 1));
111 ludata.resize(n*(2*kl + ku + 1));
115 size_t ldab = (2 *
m_kl +
m_ku + 1);
116 for (
size_t j = 0; j < n; j++) {
124 std::fill(
data.begin(),
data.end(), v);
130 std::fill(
data.begin(),
data.end(), 0.0);
147 if (i + m_ku < j || i > j +
m_kl) {
155 if (i + m_ku < j || i > j +
m_kl) {
163 int jj =
static_cast<int>(j);
164 int ii =
static_cast<int>(i);
165 size_t rw = (int)
m_kl + (
int)
m_ku + (int) ii - jj;
223 int kl =
static_cast<int>(
m_kl);
224 int ku =
static_cast<int>(
m_ku);
225 int nr =
static_cast<int>(
nRows());
226 doublereal sum = 0.0;
227 for (
int m = 0; m < nr; m++) {
229 for (
int j = m - kl; j <= m + ku; j++) {
230 if (j >= 0 && j < (
int)
m_n) {
231 sum +=
_value(m,j) * b[j];
243 int kl =
static_cast<int>(
m_kl);
244 int ku =
static_cast<int>(
m_ku);
245 int nc =
static_cast<int>(
nColumns());
246 doublereal sum = 0.0;
247 for (
int n = 0; n < nc; n++) {
249 for (
int i = n - ku; i <= n + kl; i++) {
250 if (i >= 0 && i < (
int)
m_n) {
252 sum +=
_value(ii,n) * b[ii];
275 ofstream fout(
"bandmatrix.csv");
276 fout << *
this << endl;
301 ofstream fout(
"bandmatrix.csv");
302 fout << *
this << endl;
332 size_t nr = m.
nRows();
334 for (
size_t i = 0; i < nr; i++) {
335 for (
size_t j = 0; j < nc; j++) {
345 throw CanteraError(
"BandMatrix() unimplemented function", msg);
370 return rcond(a1norm);
384 int useReturnErrorCode = 0;
391 doublereal
rcond = 0.0;
393 throw CanteraError(
"BandMatrix::rcond()",
"matrix isn't factored correctly");
403 writelogf(
"BandMatrix::rcond(): DGBCON returned INFO = %d\n", rinfo);
405 if (! useReturnErrorCode) {
431 int ku =
static_cast<int>(
m_ku);
432 int kl =
static_cast<int>(
m_kl);
433 doublereal
value = 0.0;
434 for (
int j = 0; j < (int)
m_n; j++) {
435 doublereal sum = 0.0;
437 for (
int i = j - ku; i <= j + kl; i++) {
438 sum += fabs(colP[kl + ku + i - j]);
449 valueSmall = 1.0E300;
450 size_t iSmall =
npos;
452 for (
int i = 0; i < (int)
m_n; i++) {
454 for (
int j = i - (
int)
m_kl; j <= i + (int)
m_ku; j++) {
455 if (j >= 0 && j < (
int)
m_n) {
456 vv = fabs(
value(i,j));
462 if (valueS < valueSmall) {
465 if (valueSmall == 0.0) {
475 valueSmall = 1.0E300;
476 size_t jSmall =
npos;
478 for (
int j = 0; j < (int)
m_n; j++) {
480 for (
int i = j - (
int)
m_ku; i <= j + (int)
m_kl; i++) {
481 if (i >= 0 && i < (
int)
m_n) {
482 vv = fabs(
value(i,j));
488 if (valueS < valueSmall) {
491 if (valueSmall == 0.0) {
542 size_t n =
sizeof(doublereal) *
m_n * (2 *
m_kl +
m_ku + 1);