Is out_rgb matrix invertible?

out_rgb[output_color-1] is the matrix for converting from sRGB to the chosen output space (see "convert_to_output_rgb").

If I take out_rgb[output_color-1] and invert it (using the dcraw function pseudoinverse) ,I shoul a get a matrix able totake a pixel back to sRGB from the output space.

So I take all the output pixels and perform vector by matrix multiply for each of them, expecting to get back the sRGB image.
But it does not work , the image is obviously wrong no matter what algorithm for vector dot matrix multiply I use, where am I making a mistake? The math should be correct!

Thanks!

Forums: 

have you checked that your

have you checked that your inverted matrix multiplied to original srgb-to-something matrix produces 'identity matrix' (1s on diagonal and zeroes on all other elements)

-- Alex Tutubalin @LibRaw LLC

Alex you got it, I don't get

Alex you got it, I don't get the identity matrix at all!
I then manually inverted the matrix using an online service and saw that pseudoinverse gives a very inaccurate result. If I convert the image using the right values, then the image goes back to rgb properly.
So it is all down to the matrix inversion accuracy..
Thanks for your help!