Tensorex.in_tolerance-question-mark

You're seeing just the function in_tolerance-question-mark, go back to Tensorex module for more information.
Link to this function

in_tolerance?(tensorex1, tensorex2, tolerance)

View Source

Specs

in_tolerance?(t(), t(), number()) :: boolean()

Returns if all corresponding elements are in (relative) tolerance or not.

iex> Tensorex.in_tolerance?(Tensorex.from_list([[0.0000001,  0.9999998],
...>                                            [2.0      , -0.0000003]]),
...>                        Tensorex.from_list([[0        ,  1        ],
...>                                            [2        ,  0        ]]), 1.0e-6)
true

iex> Tensorex.in_tolerance?(Tensorex.from_list([[0,  1],
...>                                            [2, -1],
...>                                            [3,  2]]),
...>                        Tensorex.from_list([[0,  1],
...>                                            [2, -1]]), 1.0e-8)
false

iex> Tensorex.in_tolerance?(Tensorex.from_list([[0        , 1],
...>                                            [2.0      , 0]]),
...>                        Tensorex.from_list([[0        , 1],
...>                                            [2.000003 , 0]]), 1.0e-6)
false

iex> Tensorex.in_tolerance?(Tensorex.from_list([[1.8200340109e62, 1.0e-52      ],
...>                                            [2.335142153e-41, 0            ]]),
...>                        Tensorex.from_list([[1.8200338243e62, 1.0000009e-52],
...>                                            [2.335142296e-41, 3.242e-7     ]]), 1.0e-6)
true

iex> Tensorex.in_tolerance?(Tensorex.from_list([[1.8200440109e62, 1.0e-52     ],
...>                                            [2.335142296e-41, 0           ]]),
...>                        Tensorex.from_list([[1.8200440109e62, 1.000002e-52],
...>                                            [2.335142296e-41, 0           ]]), 1.0e-6)
false

iex> Tensorex.in_tolerance?(Tensorex.from_list([[1,  3],
...>                                            [2,  0]]),
...>                        Tensorex.from_list([[1,  3],
...>                                            [2, -5]]), 1.0e-6)
false