/* * call-seq: * dvector.tridag(a,b,c,r) -> dvector * * Sets contents of _dvector_ to solution vector _u_ of the following tri-diagonal matrix problem. * * | b[0] c[0] 0 ... | | u[0] | | r[0] | * | a[1] b[1] c[1] ... | | u[1] | | r[1] | * | ... | * | ... | = | ... | * | ... a[n-2] b[n-2] c[n-2] | | u[n-2] | | r[n-2] | * | ... 0 a[n-1] b[n-1] | | u[n-1] | | r[n-1] | * * This corresponds to solving difference equations of the form * a[j] * u[j-1] + b[j] * u[j] + c[j] * u[j+1] = r[j], for 0 < j < n, * with boundary conditions * u[0] = (r[0] - c[0] * u[1]) / b[0], and * u[n-1] = (r[n-1] - a[n-1] * u[n-2]) / b[n-1]. * * See Numerical Recipes for more details. */ VALUE dvector_tridag(VALUE uVec, VALUE aVec, VALUE bVec, VALUE cVec, VALUE rVec) {