39#if (defined(__NVCC__) && defined(__CUDA_ARCH__)) \
40 || defined(SYCL_LANGUAGE_VERSION) \
41 || defined(HAVE_OPENMP_TARGET)
49#if defined(DEBUG) && !defined(NDEBUG)
84#if (defined(__NVCC__) && defined(__CUDA_ARCH__)) \
85 || defined(SYCL_LANGUAGE_VERSION) \
86 || defined(HAVE_OPENMP_TARGET)
90#define cs_math_zero_threshold FLT_MIN
91#define cs_math_epzero 1e-12
92#define cs_math_infinite_r 1.e30
93#define cs_math_big_r 1.e12
94#define cs_math_pi 3.14159265358979323846
108#if !(defined(__NVCC__) && defined(__CUDA_ARCH__))
134#if defined(__cplusplus)
151template <
typename T,
typename U>
157 return ((xb[0] - xa[0])*xc[0]+(xb[1] - xa[1])*xc[1]+(xb[2] - xa[2])*xc[2]);
174template <
typename T,
typename U>
179 double uv = u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
200 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
223template <
typename T,
typename U,
typename V>
229 return ( n1[0] * (
t[0]*n2[0] +
t[3]*n2[1] +
t[5]*n2[2])
230 + n1[1] * (
t[3]*n2[0] +
t[1]*n2[1] +
t[4]*n2[2])
231 + n1[2] * (
t[5]*n2[0] +
t[4]*n2[1] +
t[2]*n2[2]));
250 cs_real_t v2 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
269template <
typename T,
typename U>
278 vout[0] = inv_norm * vin[0];
279 vout[1] = inv_norm * vin[1];
280 vout[2] = inv_norm * vin[2];
299template <
typename T,
typename U,
typename V>
305 mv[0] = m[0]*v[0] + m[3]*v[1] + m[5]*v[2];
306 mv[1] = m[3]*v[0] + m[1]*v[1] + m[4]*v[2];
307 mv[2] = m[5]*v[0] + m[4]*v[1] + m[2]*v[2];
325template <
typename T,
typename U,
typename V>
332 for (
int i = 0; i < 3; i++)
333 v[i] += v_dot_n * n[i];
352template <
typename T,
typename U,
typename V>
359 = ( n1[0]*
t[0][0]*n2[0] + n1[1]*
t[1][0]*n2[0] + n1[2]*
t[2][0]*n2[0]
360 + n1[0]*
t[0][1]*n2[1] + n1[1]*
t[1][1]*n2[1] + n1[2]*
t[2][1]*n2[1]
361 + n1[0]*
t[0][2]*n2[2] + n1[1]*
t[1][2]*n2[2] + n1[2]*
t[2][2]*n2[2]);
380template <
typename T,
typename U,
typename V>
386 vout[0] = v[0]*(1.-n[0]*n[0])- v[1]* n[1]*n[0] - v[2]* n[2]*n[0];
387 vout[1] = -v[0]* n[0]*n[1] + v[1]*(1.-n[1]*n[1])- v[2]* n[2]*n[1];
388 vout[2] = -v[0]* n[0]*n[2] - v[1]* n[1]*n[2] + v[2]*(1.-n[2]*n[2]);
405template <
typename T,
typename U,
typename V>
411 uv[0] = u[1]*v[2] - u[2]*v[1];
412 uv[1] = u[2]*v[0] - u[0]*v[2];
413 uv[2] = u[0]*v[1] - u[1]*v[0];
425template <cs_lnum_t n,
typename T>
433 for (
size_t i = 0; i < n; i++) {
435 for (
size_t j = 0; j < n; j++) {
442 for (
size_t i = 0; i < n; i++) {
445 for (
size_t j = i+1; j < n; j++) {
453 for (
size_t j = 0; j < n; j++) {
455 T s = p_a[j][i] / p_a[i][i];
456 for (
size_t k = 0;
k < 2*n;
k++) {
457 p_a[j][
k] -= p_a[i][
k] * s;
465 for (
size_t i = 0; i < n; i++) {
466 T s = (T)1. / p_a[i][i];
467 for (
size_t j = 0; j < n; j++) {
468 b[i][j] = p_a[i][n+j] * s;
487 T
t[3][3] = {{a[0], a[3], a[5]},
607 return fmin(xmax, fmax(xmin, x));
615 return fminf(xmax, fmaxf(xmin, x));
668 const int n_iter = (
k > n-
k) ? n-
k :
k;
669 for (
int j = 1; j <= n_iter; j++, n--) {
672 else if (ret % j == 0)
860 v[0] = xb[0] - xa[0];
861 v[1] = xb[1] - xa[1];
862 v[2] = xb[2] - xa[2];
864 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
884 return ((xb[0] - xa[0])*xc[0]+(xb[1] - xa[1])*xc[1]+(xb[2] - xa[2])*xc[2]);
907 return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
925 cs_real_t uv = u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
948 = ( n1[0]*
t[0][0]*n2[0] + n1[1]*
t[1][0]*n2[0] + n1[2]*
t[2][0]*n2[0]
949 + n1[0]*
t[0][1]*n2[1] + n1[1]*
t[1][1]*n2[1] + n1[2]*
t[2][1]*n2[1]
950 + n1[0]*
t[0][2]*n2[2] + n1[1]*
t[1][2]*n2[2] + n1[2]*
t[2][2]*n2[2]);
975 return ( n1[0] * (
t[0]*n2[0] +
t[3]*n2[1] +
t[5]*n2[2])
976 + n1[1] * (
t[3]*n2[0] +
t[1]*n2[1] +
t[4]*n2[2])
977 + n1[2] * (
t[5]*n2[0] +
t[4]*n2[1] +
t[2]*n2[2]));
993 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
1009 cs_real_t v2 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
1033 vout[0] = inv_norm * vin[0];
1034 vout[1] = inv_norm * vin[1];
1035 vout[2] = inv_norm * vin[2];
1058 cs_real_t inv_norm = ((norm > thres) ? 1. / norm : 1. / thres);
1060 vout[0] = inv_norm * vin[0];
1061 vout[1] = inv_norm * vin[1];
1062 vout[2] = inv_norm * vin[2];
1081 vout[0] = v[0]*(1.-n[0]*n[0])- v[1]* n[1]*n[0] - v[2]* n[2]*n[0];
1082 vout[1] = -v[0]* n[0]*n[1] + v[1]*(1.-n[1]*n[1])- v[2]* n[2]*n[1];
1083 vout[2] = -v[0]* n[0]*n[2] - v[1]* n[1]*n[2] + v[2]*(1.-n[2]*n[2]);
1103 for (
int i = 0; i < 3; i++)
1104 v[i] += v_dot_n * n[i];
1125 ( n[0] *
t[0][0] * n[0] + n[1] *
t[1][0] * n[0] + n[2] *
t[2][0] * n[0]
1126 + n[0] *
t[0][1] * n[1] + n[1] *
t[1][1] * n[1] + n[2] *
t[2][1] * n[1]
1127 + n[0] *
t[0][2] * n[2] + n[1] *
t[1][2] * n[2] + n[2] *
t[2][2] * n[2]);
1128 for (
int i = 0; i < 3; i++) {
1129 for (
int j = 0; j < 3; j++)
1130 t[i][j] += n_t_n * n[i] * n[j];
1149 mv[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
1150 mv[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
1151 mv[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
1170 mv[0] += m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
1171 mv[1] += m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
1172 mv[2] += m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
1191 mv[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
1192 mv[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
1193 mv[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
1213 mv[0] = m[0]*v[0] + m[3]*v[1] + m[5]*v[2];
1214 mv[1] = m[3]*v[0] + m[1]*v[1] + m[4]*v[2];
1215 mv[2] = m[5]*v[0] + m[4]*v[1] + m[2]*v[2];
1235 mv[0] += m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
1236 mv[1] += m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
1237 mv[2] += m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
1256 return m1[0]*m2[0] + 2.*m1[3]*m2[3] + 2.*m1[5]*m2[5]
1257 + m1[1]*m2[1] + 2.*m1[4]*m2[4]
1274 return (
t[0][0] +
t[1][1] +
t[2][2]);
1290 return (
t[0] +
t[1] +
t[2]);
1309 for (
int i = 0; i < 6; i++) {
1310 for (
int j = 0; j < 6; j++)
1311 mv[i] = m[i][j] * v[j];
1331 for (
int i = 0; i < 6; i++) {
1332 for (
int j = 0; j < 6; j++)
1333 mv[i] += m[i][j] * v[j];
1350 const cs_real_t com0 = m[1][1]*m[2][2] - m[2][1]*m[1][2];
1351 const cs_real_t com1 = m[2][1]*m[0][2] - m[0][1]*m[2][2];
1352 const cs_real_t com2 = m[0][1]*m[1][2] - m[1][1]*m[0][2];
1354 return m[0][0]*com0 + m[1][0]*com1 + m[2][0]*com2;
1370 const cs_real_t com0 = m[1]*m[2] - m[4]*m[4];
1371 const cs_real_t com1 = m[4]*m[5] - m[3]*m[2];
1372 const cs_real_t com2 = m[3]*m[4] - m[1]*m[5];
1374 return m[0]*com0 + m[3]*com1 + m[5]*com2;
1392 uv[0] = (u[0] + v[0]) / 2.0;
1393 uv[1] = (u[1] + v[1]) / 2.0;
1394 uv[2] = (u[2] + v[2]) / 2.0;
1407#if defined(__INTEL_COMPILER)
1408#pragma optimization_level 0
1416 uv[0] = u[1]*v[2] - u[2]*v[1];
1417 uv[1] = u[2]*v[0] - u[0]*v[2];
1418 uv[2] = u[0]*v[1] - u[1]*v[0];
1433#if defined(__INTEL_COMPILER)
1434#pragma optimization_level 0
1442 return (u[1]*v[2] - u[2]*v[1]) * w[0]
1443 + (u[2]*v[0] - u[0]*v[2]) * w[1]
1444 + (u[0]*v[1] - u[1]*v[0]) * w[2];
1500 out[0][0] = in[1][1]*in[2][2] - in[2][1]*in[1][2];
1501 out[0][1] = in[2][1]*in[0][2] - in[0][1]*in[2][2];
1502 out[0][2] = in[0][1]*in[1][2] - in[1][1]*in[0][2];
1504 out[1][0] = in[2][0]*in[1][2] - in[1][0]*in[2][2];
1505 out[1][1] = in[0][0]*in[2][2] - in[2][0]*in[0][2];
1506 out[1][2] = in[1][0]*in[0][2] - in[0][0]*in[1][2];
1508 out[2][0] = in[1][0]*in[2][1] - in[2][0]*in[1][1];
1509 out[2][1] = in[2][0]*in[0][1] - in[0][0]*in[2][1];
1510 out[2][2] = in[0][0]*in[1][1] - in[1][0]*in[0][1];
1512 const double det = in[0][0]*out[0][0]+in[1][0]*out[0][1]+in[2][0]*out[0][2];
1513 const double invdet = 1./det;
1515 out[0][0] *= invdet, out[0][1] *= invdet, out[0][2] *= invdet;
1516 out[1][0] *= invdet, out[1][1] *= invdet, out[1][2] *= invdet;
1517 out[2][0] *= invdet, out[2][1] *= invdet, out[2][2] *= invdet;
1531 cs_real_t a00 = a[1][1]*a[2][2] - a[2][1]*a[1][2];
1532 cs_real_t a01 = a[2][1]*a[0][2] - a[0][1]*a[2][2];
1533 cs_real_t a02 = a[0][1]*a[1][2] - a[1][1]*a[0][2];
1534 cs_real_t a10 = a[2][0]*a[1][2] - a[1][0]*a[2][2];
1535 cs_real_t a11 = a[0][0]*a[2][2] - a[2][0]*a[0][2];
1536 cs_real_t a12 = a[1][0]*a[0][2] - a[0][0]*a[1][2];
1537 cs_real_t a20 = a[1][0]*a[2][1] - a[2][0]*a[1][1];
1538 cs_real_t a21 = a[2][0]*a[0][1] - a[0][0]*a[2][1];
1539 cs_real_t a22 = a[0][0]*a[1][1] - a[1][0]*a[0][1];
1541 double det_inv = 1. / (a[0][0]*a00 + a[1][0]*a01 + a[2][0]*a02);
1543 a[0][0] = a00 * det_inv;
1544 a[0][1] = a01 * det_inv;
1545 a[0][2] = a02 * det_inv;
1546 a[1][0] = a10 * det_inv;
1547 a[1][1] = a11 * det_inv;
1548 a[1][2] = a12 * det_inv;
1549 a[2][0] = a20 * det_inv;
1550 a[2][1] = a21 * det_inv;
1551 a[2][2] = a22 * det_inv;
1566 cs_real_t a00 = a[1][1]*a[2][2] - a[2][1]*a[1][2];
1567 cs_real_t a01 = a[2][1]*a[0][2] - a[0][1]*a[2][2];
1568 cs_real_t a02 = a[0][1]*a[1][2] - a[1][1]*a[0][2];
1569 cs_real_t a11 = a[0][0]*a[2][2] - a[2][0]*a[0][2];
1570 cs_real_t a12 = a[1][0]*a[0][2] - a[0][0]*a[1][2];
1571 cs_real_t a22 = a[0][0]*a[1][1] - a[1][0]*a[0][1];
1573 double det_inv = 1. / (a[0][0]*a00 + a[1][0]*a01 + a[2][0]*a02);
1575 a[0][0] = a00 * det_inv;
1576 a[0][1] = a01 * det_inv;
1577 a[0][2] = a02 * det_inv;
1578 a[1][0] = a01 * det_inv;
1579 a[1][1] = a11 * det_inv;
1580 a[1][2] = a12 * det_inv;
1581 a[2][0] = a02 * det_inv;
1582 a[2][1] = a12 * det_inv;
1583 a[2][2] = a22 * det_inv;
1604 sout[0] = s[1]*s[2] - s[4]*s[4];
1605 sout[1] = s[0]*s[2] - s[5]*s[5];
1606 sout[2] = s[0]*s[1] - s[3]*s[3];
1607 sout[3] = s[4]*s[5] - s[3]*s[2];
1608 sout[4] = s[3]*s[5] - s[0]*s[4];
1609 sout[5] = s[3]*s[4] - s[1]*s[5];
1611 detinv = 1. / (s[0]*sout[0] + s[3]*sout[3] + s[5]*sout[5]);
1636 mout[0][0] = m1[0][0]*m2[0][0] + m1[0][1]*m2[1][0] + m1[0][2]*m2[2][0];
1637 mout[0][1] = m1[0][0]*m2[0][1] + m1[0][1]*m2[1][1] + m1[0][2]*m2[2][1];
1638 mout[0][2] = m1[0][0]*m2[0][2] + m1[0][1]*m2[1][2] + m1[0][2]*m2[2][2];
1640 mout[1][0] = m1[1][0]*m2[0][0] + m1[1][1]*m2[1][0] + m1[1][2]*m2[2][0];
1641 mout[1][1] = m1[1][0]*m2[0][1] + m1[1][1]*m2[1][1] + m1[1][2]*m2[2][1];
1642 mout[1][2] = m1[1][0]*m2[0][2] + m1[1][1]*m2[1][2] + m1[1][2]*m2[2][2];
1644 mout[2][0] = m1[2][0]*m2[0][0] + m1[2][1]*m2[1][0] + m1[2][2]*m2[2][0];
1645 mout[2][1] = m1[2][0]*m2[0][1] + m1[2][1]*m2[1][1] + m1[2][2]*m2[2][1];
1646 mout[2][2] = m1[2][0]*m2[0][2] + m1[2][1]*m2[1][2] + m1[2][2]*m2[2][2];
1667 _m[0][0] = m[0][0]*q[0][0] + m[0][1]*q[1][0] + m[0][2]*q[2][0];
1668 _m[0][1] = m[0][0]*q[0][1] + m[0][1]*q[1][1] + m[0][2]*q[2][1];
1669 _m[0][2] = m[0][0]*q[0][2] + m[0][1]*q[1][2] + m[0][2]*q[2][2];
1671 _m[1][0] = m[1][0]*q[0][0] + m[1][1]*q[1][0] + m[1][2]*q[2][0];
1672 _m[1][1] = m[1][0]*q[0][1] + m[1][1]*q[1][1] + m[1][2]*q[2][1];
1673 _m[1][2] = m[1][0]*q[0][2] + m[1][1]*q[1][2] + m[1][2]*q[2][2];
1675 _m[2][0] = m[2][0]*q[0][0] + m[2][1]*q[1][0] + m[2][2]*q[2][0];
1676 _m[2][1] = m[2][0]*q[0][1] + m[2][1]*q[1][1] + m[2][2]*q[2][1];
1677 _m[2][2] = m[2][0]*q[0][2] + m[2][1]*q[1][2] + m[2][2]*q[2][2];
1680 mout[0][0] = q[0][0]*_m[0][0] + q[1][0]*_m[1][0] + q[2][0]*_m[2][0];
1681 mout[0][1] = q[0][0]*_m[0][1] + q[1][0]*_m[1][1] + q[2][0]*_m[2][1];
1682 mout[0][2] = q[0][0]*_m[0][2] + q[1][0]*_m[1][2] + q[2][0]*_m[2][2];
1684 mout[1][0] = q[0][1]*_m[0][0] + q[1][1]*_m[1][0] + q[2][1]*_m[2][0];
1685 mout[1][1] = q[0][1]*_m[0][1] + q[1][1]*_m[1][1] + q[2][1]*_m[2][1];
1686 mout[1][2] = q[0][1]*_m[0][2] + q[1][1]*_m[1][2] + q[2][1]*_m[2][2];
1688 mout[2][0] = q[0][2]*_m[0][0] + q[1][2]*_m[1][0] + q[2][2]*_m[2][0];
1689 mout[2][1] = q[0][2]*_m[0][1] + q[1][2]*_m[1][1] + q[2][2]*_m[2][1];
1690 mout[2][2] = q[0][2]*_m[0][2] + q[1][2]*_m[1][2] + q[2][2]*_m[2][2];
1711 _m[0][0] = m[0]*q[0][0] + m[3]*q[1][0] + m[5]*q[2][0];
1712 _m[0][1] = m[0]*q[0][1] + m[3]*q[1][1] + m[5]*q[2][1];
1713 _m[0][2] = m[0]*q[0][2] + m[3]*q[1][2] + m[5]*q[2][2];
1715 _m[1][0] = m[3]*q[0][0] + m[1]*q[1][0] + m[4]*q[2][0];
1716 _m[1][1] = m[3]*q[0][1] + m[1]*q[1][1] + m[4]*q[2][1];
1717 _m[1][2] = m[3]*q[0][2] + m[1]*q[1][2] + m[4]*q[2][2];
1719 _m[2][0] = m[5]*q[0][0] + m[4]*q[1][0] + m[2]*q[2][0];
1720 _m[2][1] = m[5]*q[0][1] + m[4]*q[1][1] + m[2]*q[2][1];
1721 _m[2][2] = m[5]*q[0][2] + m[4]*q[1][2] + m[2]*q[2][2];
1724 mout[0] = q[0][0]*_m[0][0] + q[1][0]*_m[1][0] + q[2][0]*_m[2][0];
1725 mout[1] = q[0][1]*_m[0][1] + q[1][1]*_m[1][1] + q[2][1]*_m[2][1];
1726 mout[2] = q[0][2]*_m[0][2] + q[1][2]*_m[1][2] + q[2][2]*_m[2][2];
1728 mout[3] = q[0][0]*_m[0][1] + q[1][0]*_m[1][1] + q[2][0]*_m[2][1];
1729 mout[4] = q[0][1]*_m[0][2] + q[1][1]*_m[1][2] + q[2][1]*_m[2][2];
1730 mout[5] = q[0][0]*_m[0][2] + q[1][0]*_m[1][2] + q[2][0]*_m[2][2];
1751 _m[0][0] = m[0][0]*q[0][0] + m[0][1]*q[0][1] + m[0][2]*q[0][2];
1752 _m[0][1] = m[0][0]*q[1][0] + m[0][1]*q[1][1] + m[0][2]*q[1][2];
1753 _m[0][2] = m[0][0]*q[2][0] + m[0][1]*q[2][1] + m[0][2]*q[2][2];
1755 _m[1][0] = m[1][0]*q[0][0] + m[1][1]*q[0][1] + m[1][2]*q[0][2];
1756 _m[1][1] = m[1][0]*q[1][0] + m[1][1]*q[1][1] + m[1][2]*q[1][2];
1757 _m[1][2] = m[1][0]*q[2][0] + m[1][1]*q[2][1] + m[1][2]*q[2][2];
1759 _m[2][0] = m[2][0]*q[0][0] + m[2][1]*q[0][1] + m[2][2]*q[0][2];
1760 _m[2][1] = m[2][0]*q[1][0] + m[2][1]*q[1][1] + m[2][2]*q[1][2];
1761 _m[2][2] = m[2][0]*q[2][0] + m[2][1]*q[2][1] + m[2][2]*q[2][2];
1764 mout[0][0] = q[0][0]*_m[0][0] + q[0][1]*_m[1][0] + q[0][2]*_m[2][0];
1765 mout[0][1] = q[0][0]*_m[0][1] + q[0][1]*_m[1][1] + q[0][2]*_m[2][1];
1766 mout[0][2] = q[0][0]*_m[0][2] + q[0][1]*_m[1][2] + q[0][2]*_m[2][2];
1768 mout[1][0] = q[1][0]*_m[0][0] + q[1][1]*_m[1][0] + q[1][2]*_m[2][0];
1769 mout[1][1] = q[1][0]*_m[0][1] + q[1][1]*_m[1][1] + q[1][2]*_m[2][1];
1770 mout[1][2] = q[1][0]*_m[0][2] + q[1][1]*_m[1][2] + q[1][2]*_m[2][2];
1772 mout[2][0] = q[2][0]*_m[0][0] + q[2][1]*_m[1][0] + q[2][2]*_m[2][0];
1773 mout[2][1] = q[2][0]*_m[0][1] + q[2][1]*_m[1][1] + q[2][2]*_m[2][1];
1774 mout[2][2] = q[2][0]*_m[0][2] + q[2][1]*_m[1][2] + q[2][2]*_m[2][2];
1795 _m[0][0] = m[0]*q[0][0] + m[3]*q[0][1] + m[5]*q[0][2];
1796 _m[0][1] = m[0]*q[1][0] + m[3]*q[1][1] + m[5]*q[1][2];
1797 _m[0][2] = m[0]*q[2][0] + m[3]*q[2][1] + m[5]*q[2][2];
1799 _m[1][0] = m[3]*q[0][0] + m[1]*q[0][1] + m[4]*q[0][2];
1800 _m[1][1] = m[3]*q[1][0] + m[1]*q[1][1] + m[4]*q[1][2];
1801 _m[1][2] = m[3]*q[2][0] + m[1]*q[2][1] + m[4]*q[2][2];
1803 _m[2][0] = m[5]*q[0][0] + m[4]*q[0][1] + m[2]*q[0][2];
1804 _m[2][1] = m[5]*q[1][0] + m[4]*q[1][1] + m[2]*q[1][2];
1805 _m[2][2] = m[5]*q[2][0] + m[4]*q[2][1] + m[2]*q[2][2];
1808 mout[0] = q[0][0]*_m[0][0] + q[0][1]*_m[1][0] + q[0][2]*_m[2][0];
1809 mout[1] = q[1][0]*_m[0][1] + q[1][1]*_m[1][1] + q[1][2]*_m[2][1];
1810 mout[2] = q[2][0]*_m[0][2] + q[2][1]*_m[1][2] + q[2][2]*_m[2][2];
1813 mout[3] = q[0][0]*_m[0][1] + q[0][1]*_m[1][1] + q[0][2]*_m[2][1];
1814 mout[4] = q[1][0]*_m[0][2] + q[1][1]*_m[1][2] + q[1][2]*_m[2][2];
1815 mout[5] = q[0][0]*_m[0][2] + q[0][1]*_m[1][2] + q[0][2]*_m[2][2];
1835 m_sym[0][0] = 0.5 * (m[0][0] + m[0][0]);
1836 m_sym[0][1] = 0.5 * (m[0][1] + m[1][0]);
1837 m_sym[0][2] = 0.5 * (m[0][2] + m[2][0]);
1838 m_sym[1][0] = 0.5 * (m[1][0] + m[0][1]);
1839 m_sym[1][1] = 0.5 * (m[1][1] + m[1][1]);
1840 m_sym[1][2] = 0.5 * (m[1][2] + m[2][1]);
1841 m_sym[2][0] = 0.5 * (m[2][0] + m[0][2]);
1842 m_sym[2][1] = 0.5 * (m[2][1] + m[1][2]);
1843 m_sym[2][2] = 0.5 * (m[2][2] + m[2][2]);
1846 m_ant[0][0] = 0.5 * (m[0][0] - m[0][0]);
1847 m_ant[0][1] = 0.5 * (m[0][1] - m[1][0]);
1848 m_ant[0][2] = 0.5 * (m[0][2] - m[2][0]);
1849 m_ant[1][0] = 0.5 * (m[1][0] - m[0][1]);
1850 m_ant[1][1] = 0.5 * (m[1][1] - m[1][1]);
1851 m_ant[1][2] = 0.5 * (m[1][2] - m[2][1]);
1852 m_ant[2][0] = 0.5 * (m[2][0] - m[0][2]);
1853 m_ant[2][1] = 0.5 * (m[2][1] - m[1][2]);
1854 m_ant[2][2] = 0.5 * (m[2][2] - m[2][2]);
1895 mout[0][0] += m1[0][0]*m2[0][0] + m1[0][1]*m2[1][0] + m1[0][2]*m2[2][0];
1896 mout[0][1] += m1[0][0]*m2[0][1] + m1[0][1]*m2[1][1] + m1[0][2]*m2[2][1];
1897 mout[0][2] += m1[0][0]*m2[0][2] + m1[0][1]*m2[1][2] + m1[0][2]*m2[2][2];
1899 mout[1][0] += m1[1][0]*m2[0][0] + m1[1][1]*m2[1][0] + m1[1][2]*m2[2][0];
1900 mout[1][1] += m1[1][0]*m2[0][1] + m1[1][1]*m2[1][1] + m1[1][2]*m2[2][1];
1901 mout[1][2] += m1[1][0]*m2[0][2] + m1[1][1]*m2[1][2] + m1[1][2]*m2[2][2];
1903 mout[2][0] += m1[2][0]*m2[0][0] + m1[2][1]*m2[1][0] + m1[2][2]*m2[2][0];
1904 mout[2][1] += m1[2][0]*m2[0][1] + m1[2][1]*m2[1][1] + m1[2][2]*m2[2][1];
1905 mout[2][2] += m1[2][0]*m2[0][2] + m1[2][1]*m2[1][2] + m1[2][2]*m2[2][2];
1930 sout[0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
1932 sout[1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
1934 sout[2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
1936 sout[3] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
1938 sout[4] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
1940 sout[5] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
1957 const int t2v[3][3] = {{0, 3, 5},
1961 const int iv2t[6] = {0, 1, 2, 0, 1, 0};
1962 const int jv2t[6] = {0, 1, 2, 1, 2, 2};
1964 for (
int i = 0; i < 6; i++) {
1965 for (
int j = 0; j < 6; j++)
1978 for (
int ij = 0; ij < 6; ij++) {
1981 for (
int k = 0;
k < 3;
k++) {
1985 sout[ij][ik] += s[j][
k];
1986 sout[ij][jk] += s[i][
k];
2014 _sout[0][0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
2016 _sout[1][1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
2018 _sout[2][2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
2020 _sout[0][1] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
2022 _sout[1][0] = s2[0]*s1[3] + s2[3]*s1[1] + s2[5]*s1[4];
2024 _sout[1][2] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
2026 _sout[2][1] = s2[3]*s1[5] + s2[1]*s1[4] + s2[4]*s1[2];
2028 _sout[0][2] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
2030 _sout[2][0] = s2[0]*s1[5] + s2[3]*s1[4] + s2[5]*s1[2];
2032 sout[0][0] = _sout[0][0]*s3[0] + _sout[0][1]*s3[3] + _sout[0][2]*s3[5];
2034 sout[1][1] = _sout[1][0]*s3[3] + _sout[1][1]*s3[1] + _sout[1][2]*s3[4];
2036 sout[2][2] = _sout[2][0]*s3[5] + _sout[2][1]*s3[4] + _sout[2][2]*s3[2];
2038 sout[0][1] = _sout[0][0]*s3[3] + _sout[0][1]*s3[1] + _sout[0][2]*s3[4];
2040 sout[1][0] = s3[0]*_sout[1][0] + s3[3]*_sout[1][1] + s3[5]*_sout[1][2];
2042 sout[1][2] = _sout[1][0]*s3[5] + _sout[1][1]*s3[4] + _sout[1][2]*s3[2];
2044 sout[2][1] = s3[3]*_sout[2][0] + s3[1]*_sout[2][1] + s3[4]*_sout[2][2];
2046 sout[0][2] = _sout[0][0]*s3[5] + _sout[0][1]*s3[4] + _sout[0][2]*s3[2];
2048 sout[2][0] = s3[0]*_sout[2][0] + s3[3]*_sout[2][1] + s3[5]*_sout[2][2];
2064 cs_real_t magnitude = sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
2066 qv->
meas = magnitude;
2070 qv->
unitv[0] = inv * v[0];
2071 qv->
unitv[1] = inv * v[1];
2072 qv->
unitv[2] = inv * v[2];
2106 const cs_real_t d11 = ldlt[2] - l10*l10*d00;
2109 const cs_real_t l21 = (ldlt[4] - l20*d00*l10) * f11;
2110 const cs_real_t l31 = (ldlt[7] - l30*d00*l10) * f11;
2113 const cs_real_t d22 = ldlt[5] - l20*d00*l20 - l21*d11*l21;
2116 const cs_real_t l32 = (ldlt[8] - l30*d00*l20 - l31*d11*l21) * f22;
2119 const cs_real_t d33 = ldlt[9] - l30*d00*l30 - l31*d11*l31 - l32*d22*l32;
2160 x[1] = rhs[1] - x[0]*ldlt[1];
2161 x[2] = rhs[2] - x[0]*ldlt[3] - x[1]*ldlt[4];
2162 x[3] = rhs[3] - x[0]*ldlt[6] - x[1]*ldlt[7] - x[2]*ldlt[8];
2164 x[3] = x[3]*ldlt[9];
#define restrict
Definition: cs_defs.h:158
#define BEGIN_C_DECLS
Definition: cs_defs.h:554
#define CS_F_HOST_DEVICE
Definition: cs_defs.h:585
double cs_real_t
Floating-point value.
Definition: cs_defs.h:357
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:374
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:376
#define END_C_DECLS
Definition: cs_defs.h:555
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:383
@ t
Definition: cs_field_pointer.h:95
@ k
Definition: cs_field_pointer.h:72
@ x2
Definition: cs_field_pointer.h:203
CS_F_HOST_DEVICE cs_real_t cs_math_3_dot_product(const T u[3], const U v[3])
Compute the dot product of two vectors of 3 real values.
Definition: cs_math.h:176
const cs_real_t cs_math_1ov6
static CS_F_HOST_DEVICE cs_real_t cs_math_pow3(cs_real_t x)
Compute the cube of a real value.
Definition: cs_math.h:803
static CS_F_HOST_DEVICE void cs_math_sym_33_inv_cramer(const cs_real_t s[6], cs_real_t *restrict sout)
Compute the inverse of a symmetric matrix using Cramer's rule.
Definition: cs_math.h:1599
CS_F_HOST_DEVICE cs_real_t cs_math_3_distance_dot_product(const T xa[3], const T xb[3], const U xc[3])
Compute .
Definition: cs_math.h:153
void cs_math_33_eig_val_vec(const cs_real_t m_in[3][3], const cs_real_t tol_err, cs_real_t eig_val[3], cs_real_t eig_vec[3][3])
Evaluate eigenvalues and eigenvectors of a real symmetric matrix m1[3,3]: m1*m2 = lambda*m2.
static CS_F_HOST_DEVICE void cs_math_33_extract_sym_ant(const cs_real_t m[3][3], cs_real_t m_sym[3][3], cs_real_t m_ant[3][3])
Extract from the given matrix its symmetric and anti-symmetric part.
Definition: cs_math.h:1830
double cs_math_surftri(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3])
Compute the area of the convex_hull generated by 3 points. This corresponds to the computation of the...
Definition: cs_math.cpp:403
static CS_F_HOST_DEVICE void cs_math_sym_33_3_product_add(const cs_real_t m[6], const cs_real_t v[3], cs_real_t *restrict mv)
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values and add it ...
Definition: cs_math.h:1231
static CS_F_HOST_DEVICE void cs_nvec3(const cs_real_t v[3], cs_nvec3_t *qv)
Define a cs_nvec3_t structure from a cs_real_3_t.
Definition: cs_math.h:2061
static CS_F_HOST_DEVICE void cs_math_33_inv_cramer_sym_in_place(cs_real_t a[3][3])
Inverse a 3x3 symmetric matrix (with non-symmetric storage) in place, using Cramer's rule.
Definition: cs_math.h:1564
const cs_real_t cs_math_infinite_r
static CS_F_HOST_DEVICE cs_real_t cs_math_pow2(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:787
const cs_real_t cs_math_4ov3
static CS_F_HOST_DEVICE void cs_math_33t_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t *restrict mv)
Compute the product of the transpose of a matrix of 3x3 real values by a vector of 3 real values.
Definition: cs_math.h:1187
static CS_F_HOST_DEVICE cs_real_t cs_math_3_square_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the squared distance between two points xa and xb in a Cartesian coordinate system of dimensi...
Definition: cs_math.h:900
static CS_F_HOST_DEVICE cs_real_t cs_math_sym_33_determinant(const cs_real_t m[6])
Compute the determinant of a 3x3 symmetric matrix.
Definition: cs_math.h:1368
static CS_F_HOST_DEVICE void cs_math_sym_33_transform_r_to_a(const cs_real_t m[6], const cs_real_t q[3][3], cs_real_t mout[6])
Compute transformation from relative to absolute reference frame Q^t M Q.
Definition: cs_math.h:1705
static CS_F_HOST_DEVICE void cs_math_sym_33_product(const cs_real_t s1[6], const cs_real_t s2[6], cs_real_t *restrict sout)
Compute the product of two symmetric matrices.
Definition: cs_math.h:1925
static CS_F_HOST_DEVICE void cs_math_33_transform_r_to_a(const cs_real_t m[3][3], const cs_real_t q[3][3], cs_real_t mout[3][3])
Compute transformation from relative to absolute reference frame Q^t M Q.
Definition: cs_math.h:1661
static CS_F_HOST_DEVICE void cs_math_66_6_product(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t *restrict mv)
Compute the product of a matrix of 6x6 real values by a vector of 6 real values.
Definition: cs_math.h:1305
void cs_math_sym_33_eigen(const cs_real_t m[6], cs_real_t eig_vals[3])
Compute all eigenvalues of a 3x3 symmetric matrix with symmetric storage.
Definition: cs_math.cpp:191
CS_F_HOST_DEVICE void cs_math_sym_33_3_product(const T m[6], const U v[3], V *restrict mv)
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values....
Definition: cs_math.h:301
static CS_F_HOST_DEVICE cs_real_t cs_math_33_main_invariant_2(const cs_real_t m[3][3])
Compute the second main invariant of the symmetric part of a 3x3 tensor.
Definition: cs_math.h:1869
const cs_real_t cs_math_2ov3
CS_F_HOST_DEVICE void cs_math_matrix_gauss_inverse(const T a[n][n], T b[n][n])
Inverse square, dense matrix using Gauss-Jordan elimination.
Definition: cs_math.h:427
static CS_F_HOST_DEVICE cs_real_t cs_math_pow4(cs_real_t x)
Compute the 4-th power of a real value.
Definition: cs_math.h:819
void cs_math_fw_and_bw_lu(const cs_real_t a_lu[], const int n, cs_real_t x[], const cs_real_t b[])
Compute forward and backward to solve an LU P*P system.
Definition: cs_math.cpp:651
const cs_real_t cs_math_1ov12
static CS_F_HOST_DEVICE void cs_math_sym_33_double_product(const cs_real_t s1[6], const cs_real_t s2[6], const cs_real_t s3[6], cs_real_t(*restrict sout)[3])
Compute the product of three symmetric matrices.
Definition: cs_math.h:2006
static CS_F_HOST_DEVICE void cs_math_66_6_product_add(const cs_real_t m[6][6], const cs_real_t v[6], cs_real_t *restrict mv)
Compute the product of a matrix of 6x6 real values by a vector of 6 real values and add it to the vec...
Definition: cs_math.h:1327
static CS_F_HOST_DEVICE void cs_math_reduce_sym_prod_33_to_66(const cs_real_t s[3][3], cs_real_t(*restrict sout)[6])
Compute a 6x6 matrix A, equivalent to a 3x3 matrix s, such as: A*R_6 = R*s^t + s*R.
Definition: cs_math.h:1954
static CS_F_HOST_DEVICE void cs_math_3_cross_product(const T u[3], const U v[3], V *restrict uv)
Compute the cross product of two vectors of 3 real values.
Definition: cs_math.h:407
static CS_F_HOST_DEVICE void cs_math_33_normal_scaling_add(const cs_real_t n[3], cs_real_t factor, cs_real_t t[3][3])
Add the dot product with a normal vector to the normal,normal component of a tensor: t += factor * n....
Definition: cs_math.h:1120
static CS_F_HOST_DEVICE void cs_math_3_normalize_threshold(const cs_real_t vin[3], const cs_real_t thres, cs_real_t vout[3])
Normalise a vector of 3 real values and clip the norm using a threshold value.
Definition: cs_math.h:1052
void cs_math_33_eigen(const cs_real_t m[3][3], cs_real_t *eig_ratio, cs_real_t *eig_max)
Compute max/min eigenvalues ratio and max. eigenvalue of a 3x3 symmetric matrix with non-symmetric st...
Definition: cs_math.cpp:280
CS_F_HOST_DEVICE cs_real_t cs_math_3_33_3_dot_product(const T n1[3], const U t[3][3], const V n2[3])
Compute the dot product of a tensor t with two vectors, n1 and n2.
Definition: cs_math.h:354
CS_F_HOST_DEVICE void cs_math_3_normal_scaling(const T n[3], U factor, V v[3])
Add the dot product with a normal vector to the normal direction to a vector.
Definition: cs_math.h:327
CS_F_HOST_DEVICE cs_real_t cs_math_3_square_norm(const T v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:248
const cs_real_t cs_math_1ov24
CS_F_HOST_DEVICE void cs_math_6_gauss_inverse_in_place(T a[6])
Inverse 3x3 symmetric matrix in place, using Gauss-Jordan elimination.
Definition: cs_math.h:485
static CS_F_HOST_DEVICE void cs_math_33_inv_cramer_in_place(cs_real_t a[3][3])
Inverse a 3x3 matrix in place, using Cramer's rule.
Definition: cs_math.h:1529
static CS_F_HOST_DEVICE void cs_math_33_inv_cramer(const cs_real_t in[3][3], cs_real_t out[3][3])
Inverse a 3x3 matrix.
Definition: cs_math.h:1497
void cs_math_fact_lu(const int n, const cs_real_t *a, cs_real_t *a_lu)
Compute LU factorization of an array of dense matrices of identical size.
Definition: cs_math.cpp:599
cs_math_sym_tensor_component_t
Definition: cs_math.h:67
@ ZZ
Definition: cs_math.h:71
@ XY
Definition: cs_math.h:72
@ XZ
Definition: cs_math.h:74
@ YZ
Definition: cs_math.h:73
@ YY
Definition: cs_math.h:70
@ XX
Definition: cs_math.h:69
CS_F_HOST_DEVICE void cs_math_3_length_unitv(const cs_real_t xa[3], const cs_real_t xb[3], cs_real_t *len, cs_real_3_t unitv)
Compute the length (Euclidean norm) between two points xa and xb in a Cartesian coordinate system of ...
Definition: cs_math.cpp:370
static CS_F_HOST_DEVICE cs_real_t cs_math_3_triple_product(const cs_real_t u[3], const cs_real_t v[3], const cs_real_t w[3])
Compute the triple product.
Definition: cs_math.h:1438
static CS_F_HOST_DEVICE void cs_math_33_3_product_add(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t *restrict mv)
Compute the product of a matrix of 3x3 real values by a vector of 3 real values add.
Definition: cs_math.h:1166
static CS_F_HOST_DEVICE cs_real_t cs_math_3_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the (euclidean) distance between two points xa and xb in a Cartesian coordinate system of dim...
Definition: cs_math.h:855
CS_F_HOST_DEVICE cs_real_t cs_math_3_norm(const T v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:198
static CS_F_HOST_DEVICE cs_real_t cs_math_pow5(cs_real_t x)
Compute the 5-th power of a real value.
Definition: cs_math.h:836
const cs_real_t cs_math_1ov3
static CS_F_HOST_DEVICE void cs_math_sym_33_transform_a_to_r(const cs_real_t m[6], const cs_real_t q[3][3], cs_real_t mout[6])
Compute transformation from absolute to relative reference frame Q M Q^t.
Definition: cs_math.h:1789
const cs_real_t cs_math_5ov3
static CS_F_HOST_DEVICE cs_real_t cs_math_33_determinant(const cs_real_t m[3][3])
Compute the determinant of a 3x3 matrix.
Definition: cs_math.h:1348
const cs_real_t cs_math_epzero
static CS_F_HOST_DEVICE void cs_math_33_product(const cs_real_t m1[3][3], const cs_real_t m2[3][3], cs_real_t mout[3][3])
Compute the product of two 3x3 real valued matrices.
Definition: cs_math.h:1632
const cs_real_t cs_math_big_r
CS_F_HOST_DEVICE void cs_math_3_orthogonal_projection(const T n[3], const U v[3], V *restrict vout)
Orthogonal projection of a vector with respect to a normalised vector.
Definition: cs_math.h:382
static CS_F_HOST_DEVICE void cs_math_33_transform_a_to_r(const cs_real_t m[3][3], const cs_real_t q[3][3], cs_real_t mout[3][3])
Compute transformation from absolute to relative reference frame Q M Q^t.
Definition: cs_math.h:1745
double cs_math_voltet(const cs_real_t xv[3], const cs_real_t xe[3], const cs_real_t xf[3], const cs_real_t xc[3])
Compute the volume of the convex_hull generated by 4 points. This is equivalent to the computation of...
Definition: cs_math.cpp:433
static CS_F_HOST_DEVICE cs_real_t cs_math_sym_44_partial_solve_ldlt(const cs_real_t ldlt[10], const cs_real_t rhs[4])
LDL^T: Modified Cholesky decomposition of a 4x4 SPD matrix. For more reference, see for instance http...
Definition: cs_math.h:2151
static CS_F_HOST_DEVICE void cs_math_3_normalize(const T vin[3], U vout[3])
Normalise a vector of 3 real values.
Definition: cs_math.h:271
static int cs_math_binom(int n, int k)
Computes the binomial coefficient of n and k.
Definition: cs_math.h:662
static CS_F_HOST_DEVICE void cs_math_3_average(const cs_real_t u[3], const cs_real_t v[3], cs_real_t *restrict uv)
Compute the average of two vector of dimension 3.
Definition: cs_math.h:1388
static CS_F_HOST_DEVICE void cs_math_33_product_add(const cs_real_t m1[3][3], const cs_real_t m2[3][3], cs_real_t(*restrict mout)[3])
Add the product of two 3x3 real matrices to a matrix.
Definition: cs_math.h:1891
static CS_F_HOST_DEVICE cs_real_t cs_math_6_trace(const cs_real_t t[6])
Compute the trace of a symmetric tensor.
Definition: cs_math.h:1288
static CS_F_HOST_DEVICE cs_real_t cs_math_sym_33_sym_33_product_trace(const cs_real_t m1[6], const cs_real_t m2[6])
Compute the product of two symmetric matrices of 3x3 real values and take the trace....
Definition: cs_math.h:1253
static CS_F_HOST_DEVICE void cs_math_sym_44_factor_ldlt(cs_real_t ldlt[10])
LDL^T: Modified Cholesky decomposition of a 4x4 SPD matrix. For more reference, see for instance http...
Definition: cs_math.h:2092
const cs_real_t cs_math_pi
static CS_F_HOST_DEVICE cs_real_t cs_math_clamp(cs_real_t x, cs_real_t xmin, cs_real_t xmax)
Clamp function for a given scalar value.
Definition: cs_math.h:751
static const cs_real_33_t cs_math_33_identity
Definition: cs_math.h:119
CS_F_HOST_DEVICE cs_real_t cs_math_3_sym_33_3_dot_product(const T n1[3], const U t[6], const V n2[3])
Compute the dot product of a symmetric tensor t with two vectors, n1 and n2.
Definition: cs_math.h:225
static const cs_real_6_t cs_math_sym_33_identity
Definition: cs_math.h:122
static CS_F_HOST_DEVICE cs_real_t cs_math_fabs(cs_real_t x)
Compute the absolute value of a real value.
Definition: cs_math.h:692
static CS_F_HOST_DEVICE cs_real_t cs_math_33_trace(const cs_real_t t[3][3])
Compute the trace of a 3x3 tensor.
Definition: cs_math.h:1272
static CS_F_HOST_DEVICE cs_real_t cs_math_fmin(cs_real_t x, cs_real_t y)
Compute the min value of two real values.
Definition: cs_math.h:710
const cs_real_t cs_math_zero_threshold
static CS_F_HOST_DEVICE void cs_math_33_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_t *restrict mv)
Compute the product of a matrix of 3x3 real values by a vector of 3 real values.
Definition: cs_math.h:1145
static CS_F_HOST_DEVICE cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:771
static CS_F_HOST_DEVICE void cs_math_3_orthonormal_basis(const cs_real_t vect[3], cs_real_t axes[3][3])
Build an orthonormal basis based on a first vector "vect". axes[0] is vect normalized,...
Definition: cs_math.h:1460
static CS_F_HOST_DEVICE cs_real_t cs_math_fmax(cs_real_t x, cs_real_t y)
Compute the max value of two real values.
Definition: cs_math.h:729
Definition: cs_array.h:1098
CS_F_HOST_DEVICE T max(const T a, const T b)
Definition: cs_defs.h:769
CS_F_HOST_DEVICE float pow2(float x)
Compute the square of a real value.
Definition: cs_math.h:629
CS_F_HOST_DEVICE T clamp(const T x, const T xmin, const T xmax)
Definition: cs_defs.h:794
CS_F_HOST_DEVICE T min(const T a, const T b)
Definition: cs_defs.h:746
CS_F_HOST_DEVICE T abs(const T a)
Definition: cs_defs.h:724
Definition: cs_defs.h:415
double meas
Definition: cs_defs.h:417
double unitv[3]
Definition: cs_defs.h:418