void Matrix<real>::MExpv(real t, const Matrix<real> & v, Matrix<real> & w) { if ((Getm() != Getn()) || (Getm() != v.Getm()) || (Getm() != w.Getm()) || (v.Getn() != 1) || (w.Getn() != 1)) { printf("Matrix size mismatch in Matrix::MExpv .\n"); throw 13; } MatrixExpv(Getm(), GetData(), t, v.GetData(), w.GetData()); }
int GetDay(int dd, int mm, int yyyy) { /* https://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week Disparate variation Another variation of the above algorithm likewise works with no lookup tables. A slight disadvantage is the unusual month and year counting convention. The formula is w = (d + \lfloor 2.6m - 0.2 \rfloor + y + \left\lfloor\frac{y}{4}\right\rfloor + \left\lfloor\frac{c}{4}\right\rfloor - 2c) \bmod 7, where Y is the year minus 1 for January or February, and the year for any other month y is the last 2 digits of Y c is the first 2 digits of Y d is the day of the month (1 to 31) m is the shifted month (March=1,...,February=12) w is the day of week (0=Sunday,...,6=Saturday) */ auto Y = GetY(mm, yyyy); int y = 0, c = 0; Getyc(Y, y, c); int m = Getm(mm); double w1 = (dd + std::floor(2.6*m - 0.2) + y + std::floor(y * 0.25) + std::floor(c * 0.25) - 2 * c); int w = static_cast<int>(w1) % 7; //std::cout << WDayMap[w] << std::endl; return w; }
int Matrix<real>::LUSolve(const Matrix<real> & x, const Matrix<real> & rhs) { if ((Getm() != Getn()) || (Getm() != x.Getm()) || (x.Getm() != rhs.Getm()) || (x.Getn() != rhs.Getn()) ) { printf("Matrix size mismatch in Matrix::LUSolve .\n"); throw 12; } int exitCode = 0; try { MatrixLUSolve(Getn(), rhs.Getn(), GetData(), x.GetData(), rhs.GetData()); } catch(int exceptionCode) { exitCode = exceptionCode; } return exitCode; }