Here is an example of manipulating an Array of pixels. I chose the x-rite ColorChecker as a model so there would be published results to check my work. A number of details about color spaces have become clear through this exercise. The color adaptation process was modeled by converting betweenXYZ and LMS. Different black points may be selected depending on how close to zero illuminance one would accept as a good model.
I look forward to extending this work to verify and improve the color calibration of my photography. Also some experimentation with demosaicing should be possible.
Corrections to the original version of theis document;
Make the scaling for a nonzero black point the same for all RGB color spaces.
Clip negative RGB values to zero.
Remove the redundant Array container from matrix multiplications.
Use map in place of the $ to apply a function to each element of an Array.