Quaternions from matrix?

Hi,

Do u know an algorithm to convert a matrix to a quaternion?

Only orthogonal matrix A can be converted.
You have to find vector v=<x,y,z> such that

  Av=v, | |v| | =1

So A is a rotation around v.
You have to find angle (alpha) of rotation.

Quaternion you want to find is given by:
q=< cos(alpha/2.),
xsin(alpha/2.),
y
sin(alpha/2.),
z*sin(alpha/2.)>