public VECV3(VECV3 v1) { dim = v1.len(); val = new VEC[dim]; for (int i = 0; i < dim; i++) { val[i] = new VEC(v1[i]); } }
public static double L2_norm_special(VECV3 v) { double s = 0; for (int i = 0; i < v.len(); i++) { for (int k = 0; k < 3; k++) { s += Math.Pow(v[i][k], 2); } } return(Math.Sqrt(s)); }
public static VECV3 fwdSubs(MATM3 m1, VECV3 b) { int len = b.len(); VECV3 v = new VECV3(len); for (int i = 0; i < len; i++) { VEC s = new VEC(3); for (int j = 0; j < i; j++) { s += m1[i][j] * v[j]; } v[i] = (b[i] - s) / m1[i][i]; } return(v); }
public static VECV3 bckSubs(MATM3 m1, VECV3 b) { int len = b.len(); VECV3 v = new VECV3(len); for (int i = 0; i < len; i++) { v[i] = b[i]; } for (int i = len - 1; i >= 0; i--) { v[i] = v[i] / m1[i][i]; for (int j = i - 1; j >= 0; j--) { v[j] = v[j] - (m1[j][i] * v[i]); } } return(v); }