// SpectralCompose recreates tensor m from its spectral decomposition // m -- 2nd order tensor in Mandel basis // λ -- eigenvalues // n -- eigenvectors [ncp][nvecs] // tmp -- temporary matrix [3][3] func SpectralCompose(m, λ []float64, n, tmp [][]float64) { for i := 0; i < 3; i++ { for j := 0; j < 3; j++ { tmp[i][j] = λ[0]*n[i][0]*n[j][0] + λ[1]*n[i][1]*n[j][1] + λ[2]*n[i][2]*n[j][2] } } tsr.Ten2Man(m, tmp) }
// spectral_decomp computes the spectral decomposition of b := F*tr(F) tensor func (o *Ogden) b_and_spectral_decomp(F [][]float64) (err error) { // determinant of F o.J, err = tsr.Inv(o.Fi, F) if err != nil { return } // left Cauchy-Green tensor tsr.LeftCauchyGreenDef(o.b, F) // eigenvalues and eigenprojectors tsr.Ten2Man(o.bm, o.b) err = tsr.M_EigenValsProjsNum(o.P, o.λ, o.bm) if err != nil { return } o.λ[0] = math.Sqrt(o.λ[0]) o.λ[1] = math.Sqrt(o.λ[1]) o.λ[2] = math.Sqrt(o.λ[2]) return }