def mulmatvec3x3(m, vect):
    """
    This function returns a 3D vector which consists of the 3D input
    vector multiplied by a 3x3 matrix.
    
    :rtype:    double iterable
    :return:   3D vector
    :type  m:  double iterable
    :param m:  The matrix to multiply
    :type  vect:  double iterable
    :param vect:  The vector - in the format[x,y,z]
        (or [x,y,z,0] for affine transformations in an homogeneous space)
  
    """


    r = [0.0, 0.0, 0.0]
    r[0] = vect[0] * m[0][0] + vect[1] * m[1][0] + vect[2] * m[2][0]
    r[1] = vect[0] * m[0][1] + vect[1] * m[1][1] + vect[2] * m[2][1]
    r[2] = vect[0] * m[0][2] + vect[1] * m[1][2] + vect[2] * m[2][2]
    return r