* matrix[0]=m_xx, matrix[1]=m_yy, matrix[2]=m_zz,
* matrix[3]=m_xy, matrix[4]=m_yz, matrix[5]=m_xz
* This method returns the 3 eigenvalues in 'eigenVals'.
+ *
+ * https://en.wikipedia.org/wiki/Eigenvalue_algorithm
*/
void computeEigenValues6(const double *matrix, double *eigenVals)
{
double tmp=p*sqp;
double phi;
if(fabs(q)<=fabs(tmp))
- phi=1./3.*acos(q/tmp);
+ if(tmp !=0)
+ phi=1./3.*acos(q/tmp);
+ else // EDF22176
+ phi=1./3.;
else
phi=0.;
if(phi<0.)
f.setArray(DataArrayDouble(18*[0.]))
self.assertTrue(f.getLocalizationOfDiscr().isEqual(coo[conn],1e-10))
+ def testDADEigenValuesPb(self):
+ """EDF22126 : eigen values with Identity matrix returned nan. Now it returns correct eigen values 1.0 """
+ valuesExp = DataArrayDouble([(1.,1.,1.),(2.,-1.,0.),(2.,0.,1.),(3.,0.,0.)])
+ d = DataArrayDouble(4, 6)
+ for i,(v0, v1, v2, v3, v4, v5,) in enumerate([
+ (1, 1, 1, 0, 0, 0),
+ (1, 0, 0, 1, 0, 1),
+ (1, 1, 1, 0, 1, 0),
+ (1, 1, 1, 1, 1, 1)]):
+ d[i] = [v0, v1, v2, v3, v4, v5]
+ self.assertTrue(d.eigenValues().isEqual(valuesExp,1e-12))
+ pass
+
pass
if __name__ == '__main__':