#NEWLINE# def get_RGB_to_XYZ_matrix( xy_red , xy_green , xy_blue , xy_white ) : #NEWLINE# #INDENT# 'Compute RGB to XYZ matrix\n    See Bruce Lindbloom page :\n    http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n\n    Args:\n        xy_red (float, float): red primary coords\n\n        xy_green (float, float): green primary coords\n\n        xy_blue (float, float): blue primary coords\n\n        xy_white (float, float): white point coords\n\n    Returns:\n        .numpy.matrix (3x3)\n\n    ' #NEWLINE# primaries_matrix = get_primaries_matrix ( xy_red , xy_green , xy_blue ) #NEWLINE# white_matrix = get_white_matrix ( xy_white ) #NEWLINE# s = ( ( primaries_matrix ** ( - 1 ) ) * white_matrix ) #NEWLINE# ( s_r , s_g , s_b ) = ( s . item ( 0 , 0 ) , s . item ( 1 , 0 ) , s . item ( 2 , 0 ) ) #NEWLINE# RGB_to_XYZ = numpy . matrix ( [ [ ( s_r * primaries_matrix . item ( 0 , 0 ) ) , ( s_g * primaries_matrix . item ( 0 , 1 ) ) , ( s_r * primaries_matrix . item ( 0 , 2 ) ) ] , [ ( s_r * primaries_matrix . item ( 1 , 0 ) ) , ( s_g * primaries_matrix . item ( 1 , 1 ) ) , ( s_b * primaries_matrix . item ( 1 , 2 ) ) ] , [ ( s_r * primaries_matrix . item ( 2 , 0 ) ) , ( s_g * primaries_matrix . item ( 2 , 1 ) ) , ( s_b * primaries_matrix . item ( 2 , 2 ) ) ] ] ) #NEWLINE# return RGB_to_XYZ