Arcane  4.2.1.0
User documentation
Loading...
Searching...
No Matches
MathReal2x2.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MathReal2x2.h (C) 2000-2026 */
9/* */
10/* Mathematical operations on Real2x2. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCCORE_BASE_MATHREAL2X2_H
13#define ARCCORE_BASE_MATHREAL2X2_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/Real2x2.h"
18#include "arccore/base/MathReal2.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane::math
24{
25/*!
26 * \brief Compares the matrix with the zero matrix.
27 *
28 * The matrix is zero if and only if each of its components
29 * is less than a given epsilon. The epsilon value used is that
30 * of float_info<value_type>::nearlyEpsilon():
31 * \f[A=0 \Leftrightarrow |A.x|<\epsilon,|A.y|<\epsilon\f]
32 *
33 * \retval true if the matrix is equal to the zero matrix,
34 * \retval false otherwise.
35 */
36constexpr ARCCORE_HOST_DEVICE bool isNearlyZero(const Real2x2& v)
37{
38 return math::isNearlyZero(v.x) && math::isNearlyZero(v.y);
39}
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
44} // namespace Arcane::math
45
46/*---------------------------------------------------------------------------*/
47/*---------------------------------------------------------------------------*/
48
49namespace Arcane
50{
51
52/*---------------------------------------------------------------------------*/
53/*---------------------------------------------------------------------------*/
54
55inline constexpr ARCCORE_HOST_DEVICE bool Real2x2::
56isNearlyZero() const
57{
58 return math::isNearlyZero(*this);
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64} // namespace Arcane
65
66/*---------------------------------------------------------------------------*/
67/*---------------------------------------------------------------------------*/
68
69#endif
Class managing a 2x2 matrix of reals.
constexpr __host__ __device__ bool isNearlyZero() const
Compares the matrix with the zero matrix.
Definition MathReal2x2.h:56
Namespace for mathematical functions.
Definition MathUtils.h:36
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --