MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / Solve

Method Solve

SRC/material/uniaxial/TriMatrix.cpp:62–95  ·  view source on GitHub ↗

Solve the system of equations this*x=d given the specified d. Uses the Thomas algorithm described in the wikipedia article: http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm Not optimized. Not destructive. Right side of the equation.

Source from the content-addressed store, hash-verified

60 /// </remarks>
61 /// <param name="d">Right side of the equation.</param>
62 double* TriDiagonalMatrixF::Solve(double* d, int dLength)
63 {
64 int n = N();
65
66
67 // cPrime
68 double* cPrime = new double[n];
69 cPrime[0] = C[0] / B[0];
70
71 for (int i = 1; i < n; i++)
72 {
73 cPrime[i] = C[i] / (B[i] - cPrime[i-1] * A[i]);
74 }
75
76 // dPrime
77 double* dPrime = new double[n];
78 dPrime[0] = d[0] / B[0];
79
80 for (int i = 1; i < n; i++)
81 {
82 dPrime[i] = (d[i] - dPrime[i-1]*A[i]) / (B[i] - cPrime[i - 1] * A[i]);
83 }
84
85 // Back substitution
86 double* x = new double[n];
87 x[n - 1] = dPrime[n - 1];
88
89 for (int i = n-2; i >= 0; i--)
90 {
91 x[i] = dPrime[i] - cPrime[i] * x[i + 1];
92 }
93
94 return x;
95 }
96TriDiagonalMatrixF::TriDiagonalMatrixF(int n)
97{
98 Lenght = n;

Callers 15

setTrialStrainMethod · 0.45
commitSensitivityMethod · 0.45
setTrialStrainMethod · 0.45
commitSensitivityMethod · 0.45
setTrialStrainMethod · 0.45
setTrialStrainMethod · 0.45
J2PlateFibre.cppFile · 0.45
commitSensitivityMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected