Function Naming convention¶
Generally, the function naming scheme in Cytnx follows the rules:
If the function is acting on objects (taking object as arguments), they will start with the first letter being capical. Examples are the linalg functions, Contract etc…
cytnx.linalg.Svd(A) cytnx.linalg.Qr(A) cytnx.linalg.Sum(A) cytnx.Contract(A,B)
If a function is a member function, or a generating function (such as zeros(), ones() …), then they usually start with a lower case letter, for example:
A = cytnx.zeros([2,3,4]) A.permute(0,2,1) B = A.contiguous()
Objects in Cytnx always start with capical letters, for example:
A = cytnx.Tensor() B = cytnx.Bond() C = cytnx.Network() C = cytnx.UniTensor()
Functions end with underscore indicate that the input will be changed. For member functions, this is an inplace operation
A = cytnx.zeros([2,3,4]) A.contiguous_() # A gets changed B = A.contiguous() # A is not changed, but return a copy B (see Tensor for further info) A.permute_(0,2,1) # A gets changed C = A.permute(0,2,1) # A is not changed but return a new B as A's permute