NiBabel

Access a cacophony of neuro-imaging file formats

Previous topic

nibabel.nicom.dwiparams.nearest_pos_semi_def

Next topic

nibabel.nicom.dwiparams.nearest_pos_semi_def

Reggie -- the one

nibabel.nicom.dwiparams.B2q

nibabel.nicom.dwiparams.B2q(B, tol=None)

Estimate q vector from input B matrix B

We assume the input B is symmetric positive definite.

Because the solution is a square root, the sign of the returned vector is arbitrary. We set the vector to have a positive x component by convention.

Parameters:

B : (3,3) array-like

B matrix - symmetric. We do not check the symmetry.

tol : None or float

absolute tolerance below which to consider eigenvalues of the B matrix to be small enough not to worry about them being negative, in check for positive semi-definite-ness. None (default) results in a fairly tight numerical threshold proportional the maximum eigenvalue

Returns:

q : (3,) vector

Estimated q vector from B matrix B