MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

maths/dual_number_automatic_differentiation.py:12–17  ·  view source on GitHub ↗
(self, real, rank)

Source from the content-addressed store, hash-verified

10
11class Dual:
12 def __init__(self, real, rank):
13 self.real = real
14 if isinstance(rank, int):
15 self.duals = [1] * rank
16 else:
17 self.duals = rank
18
19 def __repr__(self):
20 s = "+".join(f"{dual}E{n}" for n, dual in enumerate(self.duals, 1))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected