<reponame>shrishabh/tetrahedron
# Autogenerated with SMOP 0.35
from smop.core import *

def getFractionsFromUnitaryMatrix(A):
    init_prod=matlabarray(cat([1,2,0],[1,0,0],[0,1,0],[0,0,1]))
    
    rowe=A[1,:] ** 2
    
    rowmu=A[2,:] ** 2
    rowtau=A[3,:] ** 2
    mat2=A ** 2
    for i in arange(1,3).reshape(-1):
        termE[i]=sum(multiply(mat2[i,:],rowe))
        termMu[i]=sum(multiply(mat2[i,:],rowmu))
        termTau[i]=sum(multiply(mat2[i,:],rowtau))
    
    for i in arange(1,4).reshape(-1):
        final_e[i]=sum(multiply(init_prod[i,:],termE))
        final_mu[i]=sum(multiply(init_prod[i,:],termMu))
        final_tau[i]=sum(multiply(init_prod[i,:],termTau))
    
    total=final_e + final_mu + final_tau
    frac_e=final_e / total
    frac_mu=final_mu / total
    frac_tau=final_tau / total

    return frac_e, frac_mu