132 v[0] = xb[0] - xa[0];
133 v[1] = xb[1] - xa[1];
134 v[2] = xb[2] - xa[2];
136 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
154 cs_real_t uv = u[0]*v[0] + u[1]*v[1] + u[2]*v[2];
172 return sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
188 cs_real_t v2 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
209 mv[0] = m[0][0]*v[0] + m[0][1]*v[1] + m[0][2]*v[2];
210 mv[1] = m[1][0]*v[0] + m[1][1]*v[1] + m[1][2]*v[2];
211 mv[2] = m[2][0]*v[0] + m[2][1]*v[1] + m[2][2]*v[2];
230 mv[0] = m[0][0]*v[0] + m[1][0]*v[1] + m[2][0]*v[2];
231 mv[1] = m[0][1]*v[0] + m[1][1]*v[1] + m[2][1]*v[2];
232 mv[2] = m[0][2]*v[0] + m[1][2]*v[1] + m[2][2]*v[2];
252 mv[0] = m[0] * v[0] + m[3] * v[1] + m[5] * v[2];
253 mv[1] = m[3] * v[0] + m[1] * v[1] + m[4] * v[2];
254 mv[2] = m[5] * v[0] + m[4] * v[1] + m[2] * v[2];
270 const cs_real_t com0 = m[1][1]*m[2][2] - m[2][1]*m[1][2];
271 const cs_real_t com1 = m[2][1]*m[0][2] - m[0][1]*m[2][2];
272 const cs_real_t com2 = m[0][1]*m[1][2] - m[1][1]*m[0][2];
274 return m[0][0]*com0 + m[1][0]*com1 + m[2][0]*com2;
287 #if defined(__INTEL_COMPILER) 288 #pragma optimization_level 0 296 uv[0] = u[1]*v[2] - u[2]*v[1];
297 uv[1] = u[2]*v[0] - u[0]*v[2];
298 uv[2] = u[0]*v[1] - u[1]*v[0];
314 out[0][0] = in[1][1]*in[2][2] - in[2][1]*in[1][2];
315 out[0][1] = in[2][1]*in[0][2] - in[0][1]*in[2][2];
316 out[0][2] = in[0][1]*in[1][2] - in[1][1]*in[0][2];
318 out[1][0] = in[2][0]*in[1][2] - in[1][0]*in[2][2];
319 out[1][1] = in[0][0]*in[2][2] - in[2][0]*in[0][2];
320 out[1][2] = in[1][0]*in[0][2] - in[0][0]*in[1][2];
322 out[2][0] = in[1][0]*in[2][1] - in[2][0]*in[1][1];
323 out[2][1] = in[2][0]*in[0][1] - in[0][0]*in[2][1];
324 out[2][2] = in[0][0]*in[1][1] - in[1][0]*in[0][1];
326 const double det = in[0][0]*out[0][0]+in[1][0]*out[0][1]+in[2][0]*out[0][2];
327 const double invdet = 1/det;
329 out[0][0] *= invdet, out[0][1] *= invdet, out[0][2] *= invdet;
330 out[1][0] *= invdet, out[1][1] *= invdet, out[1][2] *= invdet;
331 out[2][0] *= invdet, out[2][1] *= invdet, out[2][2] *= invdet;
352 sout[0] = s[1]*s[2] - s[4]*s[4];
353 sout[1] = s[0]*s[2] - s[5]*s[5];
354 sout[2] = s[0]*s[1] - s[3]*s[3];
355 sout[3] = s[4]*s[5] - s[3]*s[2];
356 sout[4] = s[3]*s[5] - s[0]*s[4];
357 sout[5] = s[3]*s[4] - s[1]*s[5];
359 detinv = 1. / (s[0]*sout[0] + s[3]*sout[3] + s[5]*sout[5]);
388 sout[0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
390 sout[1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
392 sout[2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
394 sout[3] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
396 sout[4] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
398 sout[5] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
424 _sout[0][0] = s1[0]*s2[0] + s1[3]*s2[3] + s1[5]*s2[5];
426 _sout[1][1] = s1[3]*s2[3] + s1[1]*s2[1] + s1[4]*s2[4];
428 _sout[2][2] = s1[5]*s2[5] + s1[4]*s2[4] + s1[2]*s2[2];
430 _sout[0][1] = s1[0]*s2[3] + s1[3]*s2[1] + s1[5]*s2[4];
432 _sout[1][0] = s2[0]*s1[3] + s2[3]*s1[1] + s2[5]*s1[4];
434 _sout[1][2] = s1[3]*s2[5] + s1[1]*s2[4] + s1[4]*s2[2];
436 _sout[2][1] = s2[3]*s1[5] + s2[1]*s1[4] + s2[4]*s1[2];
438 _sout[0][2] = s1[0]*s2[5] + s1[3]*s2[4] + s1[5]*s2[2];
440 _sout[2][0] = s2[0]*s1[5] + s2[3]*s1[4] + s2[5]*s1[2];
442 sout[0][0] = _sout[0][0]*s3[0] + _sout[0][1]*s3[3] + _sout[0][2]*s3[5];
444 sout[1][1] = _sout[1][0]*s3[3] + _sout[1][1]*s3[1] + _sout[1][2]*s3[4];
446 sout[2][2] = _sout[2][0]*s3[5] + _sout[2][1]*s3[4] + _sout[2][2]*s3[2];
448 sout[0][1] = _sout[0][0]*s3[3] + _sout[0][1]*s3[1] + _sout[0][2]*s3[4];
450 sout[1][0] = s3[0]*_sout[1][0] + s3[3]*_sout[1][1] + s3[5]*_sout[1][2];
452 sout[1][2] = _sout[1][0]*s3[5] + _sout[1][1]*s3[4] + _sout[1][2]*s3[2];
454 sout[2][1] = s3[2]*_sout[2][0] + s3[1]*_sout[2][1] + s3[4]*_sout[2][2];
456 sout[0][2] = _sout[0][0]*s3[5] + _sout[0][1]*s3[4] + _sout[0][2]*s3[2];
458 sout[2][0] = s3[0]*_sout[2][0] + s3[3]*_sout[2][1] + s3[5]*_sout[2][2];
static void cs_math_sym_33_inv_cramer(const cs_real_t s[6], cs_real_t sout[restrict 6])
Compute the inverse of a symmetric matrix using Cramer's rule.
Definition: cs_math.h:347
void symmetric_matrix_inverse(const cs_real_6_t s, cs_real_6_t sout)
Definition: cs_math.c:114
#define restrict
Definition: cs_defs.h:122
static cs_real_t cs_math_3_dot_product(const cs_real_t u[3], const cs_real_t v[3])
Compute the dot product of two vectors of 3 real values.
Definition: cs_math.h:151
const cs_real_t cs_math_onesix
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:310
size_t len
Definition: mei_scanner.c:600
const cs_real_t cs_math_big_r
void symmetric_matrix_product(const cs_real_6_t s1, const cs_real_6_t s2, cs_real_6_t sout)
Definition: cs_math.c:128
static void cs_math_33_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_3_t mv)
Compute the product of a matrix of 3x3 real values by a vector of 3 real values.
Definition: cs_math.h:205
const cs_real_t cs_math_pi
static void cs_math_33_inv(const cs_real_t in[3][3], cs_real_t out[3][3])
Inverse a 3x3 matrix.
Definition: cs_math.h:311
#define BEGIN_C_DECLS
Definition: cs_defs.h:448
const cs_real_t cs_math_epzero
void cs_math_33_eigen(const cs_real_t m[3][3], cs_real_t *eig_ratio, cs_real_t *eig_max)
Compute the eigenvalues of a 3x3 matrix which is symmetric and real -> Oliver K. Smith "eigenvalues o...
Definition: cs_math.c:190
static 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 sout[restrict 3][3])
Compute the product of three symmetric matrices.
Definition: cs_math.h:416
double cs_real_t
Floating-point value.
Definition: cs_defs.h:296
static cs_real_t cs_math_3_length(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the (euclidean) length between two points xa and xb in a cartesian coordinate system of dimen...
Definition: cs_math.h:127
Definition: cs_field_pointer.h:67
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:186
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:109
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.c:308
double precision, dimension(:,:,:), allocatable v
Definition: atimbr.f90:114
static void cs_math_sym_33_product(const cs_real_t s1[6], const cs_real_t s2[6], cs_real_t sout[restrict 6])
Compute the product of two symmetric matrices.
Definition: cs_math.h:383
double cs_math_get_machine_epsilon(void)
Get the value related to the machine precision.
Definition: cs_math.c:171
const cs_real_t cs_math_onetwelve
void cs_math_set_machine_epsilon(void)
Compute the value related to the machine precision.
Definition: cs_math.c:150
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.c:338
static 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:268
static cs_real_t cs_math_3_norm(const cs_real_t v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:170
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:308
static void cs_math_3_cross_product(const cs_real_t u[3], const cs_real_t v[3], cs_real_t uv[restrict 3])
Compute the cross product of two vectors of 3 real values.
Definition: cs_math.h:292
const cs_real_t cs_math_zero_threshold
const cs_real_t cs_math_onethird
#define END_C_DECLS
Definition: cs_defs.h:449
static void cs_math_33t_3_product(const cs_real_t m[3][3], const cs_real_t v[3], cs_real_3_t 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:226
#define CS_PROCF(x, y)
Definition: cs_defs.h:472
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:314
static void cs_math_sym_33_3_product(const cs_real_t m[6], const cs_real_t v[3], cs_real_t mv[restrict 3])
Compute the product of a symmetric matrix of 3x3 real values by a vector of 3 real values...
Definition: cs_math.h:248
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 (euclidien norm) between two points xa and xb in a cartesian coordinate system of ...
Definition: cs_math.c:275
const cs_real_t cs_math_infinite_r