How to use the compas.hpc.multiply_matrices_numba function in compas

To help you get started, we’ve selected a few compas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
))

    K1 = zero123
    K3 = zero123
    K2 = mdotm(-L2, (M3 * Szu + M2 * Sxu)) + mdotm(L3, (M3 * Syu - M1 * Sxu))
    K4 = mdotm( L2, (M3 * Szv - M5 * Sxv)) - mdotm(L3, (M3 * Syv + M4 * Sxv))

    Kg3 = hstack((K1, K2, K3, K4))

    K11 *= 0.
    K13 *= 0.
    K31 *= 0.
    K33 *= 0.

    Sr0Syu = mdotm(-Sr0, Syu)
    Sr0Syv = mdotm(-Sr0, Syv)
    Sr0Szu = mdotm(-Sr0, Szu)
    Sr0Szv = mdotm(-Sr0, Szv)
    Sr1Sxu = mdotm(Sr1, Sxu)
    Sr1Sxv = mdotm(Sr1, Sxv)
    Sr1Szu = mdotm(Sr1, Szu)
    Sr1Szv = mdotm(Sr1, Szv)
    Sr2Sxu = mdotm(Sr2, Sxu)
    Sr2Sxv = mdotm(Sr2, Sxv)
    Sr2Syu = mdotm(Sr2, Syu)
    Sr2Syv = mdotm(Sr2, Syv)

    K22 = +M3 * (Sr1Szu - Sr2Syu) + M2 * (Sr0Syu + Sr1Sxu) + M1 * (Sr0Szu + Sr2Sxu)
    K44 = -M3 * (Sr1Szv - Sr2Syv) + M5 * (Sr0Syv + Sr1Sxv) + M4 * (Sr0Szv + Sr2Sxv)

    Kg4 = vstack((
        hstack((K11, K12, K13, K14)),
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
K11 *= 0.
    K13 *= 0.
    K31 *= 0.
    K33 *= 0.

    Sr0Syu = mdotm(-Sr0, Syu)
    Sr0Syv = mdotm(-Sr0, Syv)
    Sr0Szu = mdotm(-Sr0, Szu)
    Sr0Szv = mdotm(-Sr0, Szv)
    Sr1Sxu = mdotm(Sr1, Sxu)
    Sr1Sxv = mdotm(Sr1, Sxv)
    Sr1Szu = mdotm(Sr1, Szu)
    Sr1Szv = mdotm(Sr1, Szv)
    Sr2Sxu = mdotm(Sr2, Sxu)
    Sr2Sxv = mdotm(Sr2, Sxv)
    Sr2Syu = mdotm(Sr2, Syu)
    Sr2Syv = mdotm(Sr2, Syv)

    K22 = +M3 * (Sr1Szu - Sr2Syu) + M2 * (Sr0Syu + Sr1Sxu) + M1 * (Sr0Szu + Sr2Sxu)
    K44 = -M3 * (Sr1Szv - Sr2Syv) + M5 * (Sr0Syv + Sr1Sxv) + M4 * (Sr0Szv + Sr2Sxv)

    Kg4 = vstack((
        hstack((K11, K12, K13, K14)),
        hstack((K21, K22, K23, K24)),
        hstack((K31, K32, K33, K34)),
        hstack((K41, K42, K43, K44))
    ))

    k = 1. / li * (M2 * yu + M1 * zu + M5 * yv + M4 * zv)

    K22 *= 0.
    K44 *= 0.
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_geomstiff.py View on Github external
mu = 2. * abs(arctan(normq / q_0))
    if mu == 0.:
        e = array([1., 1., 1.])
    else:
        e = q / normq

    S = zeros((3, 3))
    S[0, 1] = -e[2]
    S[0, 2] =  e[1]
    S[1, 0] =  e[2]
    S[1, 2] = -e[0]
    S[2, 0] = -e[1]
    S[2, 1] =  e[0]

    dRm = eye(3) + sin(0.5 * mu) * S + (1. - cos(0.5 * mu)) * multiply_matrices_numba(S, S)
    R_e = multiply_matrices_numba(dRm, T_u)

    return R_e
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
hstack((K41, K42, K43, K44))
    ))

    k = 1. / li * (M2 * yu + M1 * zu + M5 * yv + M4 * zv)

    K22 *= 0.
    K44 *= 0.
    K12 = -(M2 * mdotm(B, Syu) + M1 * mdotm(B, Szu))
    K32 = -K12
    K21 =  K12.transpose()
    K23 = -K12.transpose()
    K14 = -(M5 * mdotm(B, Syv) + M4 * mdotm(B, Szv))
    K34 = -K14
    K41 =  K14.transpose()
    K43 = -K14.transpose()
    K11 = mdotm(mdotm(B, k), xet) + mdotm(mdotm(xe, k.transpose()), B) + (mdotm(xet, k) * B)
    K33 =  K11
    K13 = -K11
    K31 = -K11

    Kg5 = vstack((hstack((K11, K12, K13, K14)), hstack((K21, K22, K23, K24)), hstack((K31, K32, K33, K34)), hstack((K41, K42, K43, K44))))

    Df = zeros((6, 6))
    Df[0, 0] = f_[1][0] * tan(theta[0])
    Df[1, 1] = f_[2][0] * tan(theta[2])
    Df[2, 2] = f_[3][0] * tan(theta[4])
    Df[3, 3] = f_[4][0] * tan(theta[1])
    Df[4, 4] = f_[5][0] * tan(theta[3])
    Df[5, 5] = f_[6][0] * tan(theta[5])

    Kg6 = mdotm(mdotm(T[:, 1:7], Df), T[:, 1:7].transpose())
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_geomstiff.py View on Github external
k = 1 / li * (M[2] * yu + M[1] * zu + M[5] * yv + M[4] * zv)
    K11 = multiply_matrices_numba(multiply_matrices_numba(B, k), xe.transpose()) + multiply_matrices_numba(multiply_matrices_numba(xe, k.transpose()), B) + (multiply_matrices_numba(xe.transpose(), k) * B)
    K33 = K11
    K13 = -K11
    K31 = -K11

    K_g5 = vstack((hstack((K11, K12, K13, K14)), hstack((K21, K22, K23, K24)), hstack((K31, K32, K33, K34)), hstack((K41, K42, K43, K44))))

    Df = zeros((6, 6))
    Df[0, 0] = f_[1][0] * tan(theta[0])
    Df[1, 1] = f_[2][0] * tan(theta[2])
    Df[2, 2] = f_[3][0] * tan(theta[4])
    Df[3, 3] = f_[4][0] * tan(theta[1])
    Df[4, 4] = f_[5][0] * tan(theta[3])
    Df[5, 5] = f_[6][0] * tan(theta[5])
    K_g6 = multiply_matrices_numba(multiply_matrices_numba(T[:, 1:7], Df), T[:, 1:7].transpose())

    Sx = _skew_(Sx, xe.transpose()[0])
    Szuzv = _skew_(Szuzv, zuzv.transpose()[0])
    Syvyu = _skew_(Syvyu, yvyu.transpose()[0])

    r1T_B = multiply_matrices_numba(r1.transpose(), B)
    r2T_B = multiply_matrices_numba(r2.transpose(), B)
    r1T_xe = multiply_matrices_numba(r1.transpose(), xe)
    r2T_xe = multiply_matrices_numba(r2.transpose(), xe)
    B_r1 = multiply_matrices_numba(B, r1)
    B_r2 = multiply_matrices_numba(B, r2)
    B_r1_xeT = multiply_matrices_numba(B_r1, xe.transpose())
    B_r2_xeT = multiply_matrices_numba(B_r2, xe.transpose())
    r1T_xe = multiply_matrices_numba(r1.transpose(), xe) / (2 * li)
    r2T_xe = multiply_matrices_numba(r2.transpose(), xe) / (2 * li)
    xeT_Sr1 = multiply_matrices_numba(xe.transpose(), Sr1)
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
Kg6 = mdotm(mdotm(T[:, 1:7], Df), T[:, 1:7].transpose())

    Sx = _skew_(Sx, xet[0])
    Szuzv = _skew_(Szuzv, zuzv.transpose()[0])
    Syvyu = _skew_(Syvyu, yvyu.transpose()[0])

    r1t = r1.transpose()
    r2t = r2.transpose()
    r1T_B  = mdotm(r1t, B)
    r2T_B  = mdotm(r2t, B)
    r1T_xe = mdotm(r1t, xe)
    r2T_xe = mdotm(r2t, xe)
    Br1 = mdotm(B, r1)
    Br2 = mdotm(B, r2)
    Br1_xet = mdotm(Br1, xet)
    Br2_xet = mdotm(Br2, xet)
    r1T_xe = mdotm(r1t, xe) / (2 * li)
    r2T_xe = mdotm(r2t, xe) / (2 * li)
    xeT_Sr1 = mdotm(xet, Sr1)
    xeT_Sr2 = mdotm(xet, Sr2)
    BSr1  = mdotm(B, Sr1)
    BSr2  = mdotm(B, Sr2)
    Sr1_xe = mdotm(Sr1, xe)
    Sr2_xe = mdotm(Sr2, xe)
    SxSr1 = mdotm(Sx, Sr1)
    SxSr2 = mdotm(Sx, Sr2)

    Kg21 = Kg2(r1, zuzv, B, li, xe, r0, Sr0, Sx, Sr1, Szuzv, r1T_B, r1T_xe, Br1, Br1_xet, xeT_Sr1, BSr1, Sr1_xe, SxSr1)
    Kg22 = Kg2(r2, yvyu, B, li, xe, r0, Sr0, Sx, Sr2, Syvyu, r2T_B, r2T_xe, Br2, Br2_xet, xeT_Sr2, BSr2, Sr2_xe, SxSr2)
    Kg23 = Kg2(r1, xu, B, li, xe, r0, Sr0, Sx, Sr1, Sxu, r1T_B, r1T_xe, Br1, Br1_xet, xeT_Sr1, BSr1, Sr1_xe, SxSr1)
    Kg24 = Kg2(r2, xu, B, li, xe, r0, Sr0, Sx, Sr2, Sxu, r2T_B, r2T_xe, Br2, Br2_xet, xeT_Sr2, BSr2, Sr2_xe, SxSr2)
    Kg25 = Kg2(r1, xv, B, li, xe, r0, Sr0, Sx, Sr1, Sxv, r1T_B, r1T_xe, Br1, Br1_xet, xeT_Sr1, BSr1, Sr1_xe, SxSr1)
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_updated.py View on Github external
U = -0.5 * mdotm(Bo, riT_B) + (riT_xe / (2 * l)) * mdotm(Bo, xt) + (oT_xr0 / (2 * l)) * B_ri_xeT

    K11 = U + U.transpose() + riT_xe * (2 * mdotm(xt, o) + mdotm(ot, r_0)) * B
    K33 =  K11
    K13 = -K11
    K31 = -K11
    K12 = 0.25 * (mdotm(-Bo, xeT_Sri) - mdotm(B_ri, mdotm(ot, Sr0)) - oT_xr0 * B_Sri)
    K14 =  K12
    K32 = -K12
    K34 = -K12
    K21 =  K12.transpose()
    K41 =  K12.transpose()
    K23 = -K12.transpose()
    K43 = -K12.transpose()
    K22 = ((-riT_xe * mdotm(So, Sr0) + mdotm(mdotm(Sr0, o), xeT_Sri) + mdotm(Sri_xe, mdotm(ot, Sr0)) -
            mdotm(xt + r_0.transpose(), o) * Sx_Sri + 2 * mdotm(So, Sri)) / 8)
    K24 = K22
    K42 = K22
    K44 = K22

    Kg2 = vstack((
        hstack((K11, K12, K13, K14)),
        hstack((K21, K22, K23, K24)),
        hstack((K31, K32, K33, K34)),
        hstack((K41, K42, K43, K44))
    ))

    return Kg2
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof.py View on Github external
K11 *= 0.
    K13 *= 0.
    K31 *= 0.
    K33 *= 0.

    Sr0Syu = mdotm(-Sr0, Syu)
    Sr0Syv = mdotm(-Sr0, Syv)
    Sr0Szu = mdotm(-Sr0, Szu)
    Sr0Szv = mdotm(-Sr0, Szv)
    Sr1Sxu = mdotm(Sr1, Sxu)
    Sr1Sxv = mdotm(Sr1, Sxv)
    Sr1Szu = mdotm(Sr1, Szu)
    Sr1Szv = mdotm(Sr1, Szv)
    Sr2Sxu = mdotm(Sr2, Sxu)
    Sr2Sxv = mdotm(Sr2, Sxv)
    Sr2Syu = mdotm(Sr2, Syu)
    Sr2Syv = mdotm(Sr2, Syv)

    K22 = +M3 * (Sr1Szu - Sr2Syu) + M2 * (Sr0Syu + Sr1Sxu) + M1 * (Sr0Szu + Sr2Sxu)
    K44 = -M3 * (Sr1Szv - Sr2Syv) + M5 * (Sr0Syv + Sr1Sxv) + M4 * (Sr0Szv + Sr2Sxv)

    Kg4 = vstack((
        hstack((K11, K12, K13, K14)),
        hstack((K21, K22, K23, K24)),
        hstack((K31, K32, K33, K34)),
        hstack((K41, K42, K43, K44))
    ))

    k = 1. / li * (M2 * yu + M1 * zu + M5 * yv + M4 * zv)

    K22 *= 0.
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_geomstiff.py View on Github external
K11 = 0 * K11
    K13 = 0 * K13
    K31 = 0 * K31
    K33 = 0 * K33

    K22 = M[3] * (multiply_matrices_numba(Sr1, Szu) - multiply_matrices_numba(Sr2, Syu)) + M[2] * (multiply_matrices_numba(-Sr0, Syu) + multiply_matrices_numba(Sr1, Sxu)) + M[1] * (multiply_matrices_numba(-Sr0, Szu) + multiply_matrices_numba(Sr2, Sxu))

    K44 = -M[3] * (multiply_matrices_numba(Sr1, Szv) - multiply_matrices_numba(Sr2, Syv)) + M[5] * (multiply_matrices_numba(-Sr0, Syv) + multiply_matrices_numba(Sr1, Sxv)) + M[4] * (multiply_matrices_numba(-Sr0, Szv) + multiply_matrices_numba(Sr2, Sxv))

    K_g4 = vstack((hstack((K11, K12, K13, K14)), hstack((K21, K22, K23, K24)), hstack((K31, K32, K33, K34)), hstack((K41, K42, K43, K44))))

    K22 = 0 * K22
    K44 = 0 * K44

    K12 = -(M[2] * multiply_matrices_numba(B, Syu) + M[1] * multiply_matrices_numba(B, Szu))
    K32 = -K12
    K21 = K12.transpose()
    K23 = -K12.transpose()

    K14 = -(M[5] * multiply_matrices_numba(B, Syv) + M[4] * multiply_matrices_numba(B, Szv))
    K34 = -K14
    K41 = K14.transpose()
    K43 = -K14.transpose()

    k = 1 / li * (M[2] * yu + M[1] * zu + M[5] * yv + M[4] * zv)
    K11 = multiply_matrices_numba(multiply_matrices_numba(B, k), xe.transpose()) + multiply_matrices_numba(multiply_matrices_numba(xe, k.transpose()), B) + (multiply_matrices_numba(xe.transpose(), k) * B)
    K33 = K11
    K13 = -K11
    K31 = -K11

    K_g5 = vstack((hstack((K11, K12, K13, K14)), hstack((K21, K22, K23, K24)), hstack((K31, K32, K33, K34)), hstack((K41, K42, K43, K44))))
github compas-dev / compas / src / compas / numerical / algorithms / dr_6dof_updated.py View on Github external
K1 = zero123
    K3 = zero123
    K2 = mdotm(-L2, (M3 * Szu + M2 * Sxu)) + mdotm(L3, (M3 * Syu - M1 * Sxu))
    K4 = mdotm( L2, (M3 * Szv - M5 * Sxv)) - mdotm(L3, (M3 * Syv + M4 * Sxv))

    Kg3 = hstack((K1, K2, K3, K4))

    K11 *= 0.
    K13 *= 0.
    K31 *= 0.
    K33 *= 0.

    Sr0Syu = mdotm(-Sr0, Syu)
    Sr0Syv = mdotm(-Sr0, Syv)
    Sr0Szu = mdotm(-Sr0, Szu)
    Sr0Szv = mdotm(-Sr0, Szv)
    Sr1Sxu = mdotm(Sr1, Sxu)
    Sr1Sxv = mdotm(Sr1, Sxv)
    Sr1Szu = mdotm(Sr1, Szu)
    Sr1Szv = mdotm(Sr1, Szv)
    Sr2Sxu = mdotm(Sr2, Sxu)
    Sr2Sxv = mdotm(Sr2, Sxv)
    Sr2Syu = mdotm(Sr2, Syu)
    Sr2Syv = mdotm(Sr2, Syv)

    K22 = +M3 * (Sr1Szu - Sr2Syu) + M2 * (Sr0Syu + Sr1Sxu) + M1 * (Sr0Szu + Sr2Sxu)
    K44 = -M3 * (Sr1Szv - Sr2Syv) + M5 * (Sr0Syv + Sr1Sxv) + M4 * (Sr0Szv + Sr2Sxv)

    Kg4 = vstack((
        hstack((K11, K12, K13, K14)),
        hstack((K21, K22, K23, K24)),
        hstack((K31, K32, K33, K34)),