MCPcopy Index your code
hub / github.com/subbarayudu-j/TheAlgorithms-Python / component

Method component

linear_algebra_python/src/lib.py:69–77  ·  view source on GitHub ↗

input: index (start at 0) output: the i-th component of the vector.

(self,i)

Source from the content-addressed store, hash-verified

67 """
68 return "(" + ",".join(map(str, self.__components)) + ")"
69 def component(self,i):
70 """
71 input: index (start at 0)
72 output: the i-th component of the vector.
73 """
74 if type(i) is int and -len(self.__components) <= i < len(self.__components) :
75 return self.__components[i]
76 else:
77 raise Exception("index out of range")
78 def __len__(self):
79 """
80 returns the size of the vector

Callers 9

test_componentMethod · 0.95
test_addMethod · 0.45
test_subMethod · 0.45
__add__Method · 0.45
__sub__Method · 0.45
__mul__Method · 0.45
__mul__Method · 0.45
__add__Method · 0.45
__sub__Method · 0.45

Calls

no outgoing calls

Tested by 3

test_componentMethod · 0.76
test_addMethod · 0.36
test_subMethod · 0.36