Debian Codegraph @

src/matrix.rs

raw symbols SCIP
1 //! This module provides simple matrix operations on 3x3 matrices to aid in
2 //! chromatic adaptation and conversion calculations.
3
4 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#;
5
6 use craterust-analyzer cargo palette 0.7.6 crate/::{
7 convertrust-analyzer cargo palette 0.7.6 convert/::IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#,
8 encodingrust-analyzer cargo palette 0.7.6 encoding/::Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#,
9 numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#, IsValidDivisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#, Reciprust-analyzer cargo palette 0.7.6 num/Recip#},
10 rgbrust-analyzer cargo palette 0.7.6 rgb/::{Primariesrust-analyzer cargo palette 0.7.6 rgb/Primaries#, Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#, RgbSpacerust-analyzer cargo palette 0.7.6 rgb/RgbSpace#},
11 white_pointrust-analyzer cargo palette 0.7.6 white_point/::{Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#},
12 Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#, Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#,
13 };
14
15 /// A 9 element array representing a 3x3 matrix.
16 pub type Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T> = [T; 9];
17
18 /// Multiply the 3x3 matrix with an XYZ color.
19 #[inline]
20 pub fn multiply_xyzrust-analyzer cargo palette 0.7.6 matrix/multiply_xyz().<T>(c: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>, f: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>) -> Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>
21 where
22 T: Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#,
23 {
24 // Input Mat3 is destructured to avoid panic paths
25 let [c0, c1, c2, c3, c4, c5, c6, c7, c8] = c;
26
27 let x1 = c0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.;
28 let y1 = c3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.;
29 let z1 = c6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.;
30 let x2 = c1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.;
31 let y2 = c4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.;
32 let z2 = c7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.;
33 let x3 = c2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.;
34 let y3 = c5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.;
35 let z3 = c8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.;
36
37 Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# {
38 xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.: x1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().x2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().x3,
39 yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.: y1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().y2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().y3,
40 zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.: z1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().z2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().z3,
41 white_pointrust-analyzer cargo palette 0.7.6 xyz/Xyz#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
42 }
43 }
44 /// Multiply the 3x3 matrix with an XYZ color to return an RGB color.
45 #[inline]
46 pub fn multiply_xyz_to_rgbrust-analyzer cargo palette 0.7.6 matrix/multiply_xyz_to_rgb().<S, V, T>(c: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>, f: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<S::WhitePointrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#WhitePoint#, V>) -> Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S>, V>
47 where
48 S: RgbSpacerust-analyzer cargo palette 0.7.6 rgb/RgbSpace#,
49 V: Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T>,
50 {
51 // Input Mat3 is destructured to avoid panic paths. red, green, and blue
52 // can't be extracted like in `multiply_xyz` to get a performance increase
53 let [c0, c1, c2, c3, c4, c5, c6, c7, c8] = c;
54
55 Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb# {
56 redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.)
57 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.)
58 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c2) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.),
59 greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.)
60 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.)
61 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c5) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.),
62 bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c6) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.),
63 standardrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
64 }
65 }
66 /// Multiply the 3x3 matrix with an RGB color to return an XYZ color.
67 #[inline]
68 pub fn multiply_rgb_to_xyzrust-analyzer cargo palette 0.7.6 matrix/multiply_rgb_to_xyz().<S, V, T>(c: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>, f: Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S>, V>) -> Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<S::WhitePointrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#WhitePoint#, V>
69 where
70 S: RgbSpacerust-analyzer cargo palette 0.7.6 rgb/RgbSpace#,
71 V: Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T>,
72 {
73 // Input Mat3 is destructured to avoid panic paths. Same problem as
74 // `multiply_xyz_to_rgb` for extracting x, y, z
75 let [c0, c1, c2, c3, c4, c5, c6, c7, c8] = c;
76
77 Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# {
78 xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.)
79 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c1) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.)
80 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c2) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.),
81 yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c3) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.)
82 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.)
83 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c5) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.),
84 zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.: (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c6) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.)
85 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.)
86 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(c8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.),
87 white_pointrust-analyzer cargo palette 0.7.6 xyz/Xyz#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
88 }
89 }
90
91 /// Multiply two 3x3 matrices.
92 #[inline]
93 pub fn multiply_3x3rust-analyzer cargo palette 0.7.6 matrix/multiply_3x3().<T>(c: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>, f: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>) -> Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>
94 where
95 T: Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
96 {
97 // Input Mat3 are destructured to avoid panic paths
98 let [c0, c1, c2, c3, c4, c5, c6, c7, c8] = c;
99 let [f0, f1, f2, f3, f4, f5, f6, f7, f8] = f;
100
101 let o0 = c0.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c1.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c2.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f6;
102 let o1 = c0.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c1.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c2.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f7;
103 let o2 = c0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f8;
104
105 let o3 = c3.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c4.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c5.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f6;
106 let o4 = c3.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c4.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c5.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f7;
107 let o5 = c3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&f8;
108
109 let o6 = c6.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c7.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c8.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f6;
110 let o7 = c6.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c7.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c8.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f7;
111 let o8 = c6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().c8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().f8;
112
113 [o0, o1, o2, o3, o4, o5, o6, o7, o8]
114 }
115
116 /// Invert a 3x3 matrix and panic if matrix is not invertible.
117 #[inline]
118 pub fn matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse().<T>(a: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>) -> Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>
119 where
120 T: Reciprust-analyzer cargo palette 0.7.6 num/Recip# + IsValidDivisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool> + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
121 {
122 // This function runs fastest with assert and no destructuring. The `det`'s
123 // location should not be changed until benched that it's faster elsewhere
124 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(a.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). 8);
125
126 let d0 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
127 let d1 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
128 let d2 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
129 let mut det = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&d0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&d1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&d2;
130 let d3 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
131 let d4 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
132 let d5 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().6]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
133 let d6 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
134 let d7 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().5]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().2]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
135 let d8 = a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().4]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().3]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().;
136
137 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().det.is_valid_divisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#is_valid_divisor().() {
138 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("The given matrix is not invertible")
139 }
140 det = det.reciprust-analyzer cargo palette 0.7.6 num/Recip#recip().();
141
142 [
143 d0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
144 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().d3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
145 d6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
146 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().d1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
147 d4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
148 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().d7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
149 d2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
150 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().d5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&det,
151 d8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().det,
152 ]
153 }
154
155 /// Maps a matrix from one item type to another.
156 ///
157 /// This turned out to be easier for the compiler to optimize than `matrix.map(f)`.
158 #[inline(always)]
159 pub fn matrix_maprust-analyzer cargo palette 0.7.6 matrix/matrix_map().<T, U>(matrix: Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>, mut f: impl FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(T) -> U) -> Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<U> {
160 let [m1, m2, m3, m4, m5, m6, m7, m8, m9] = matrix;
161 [
162 f(m1),
163 f(m2),
164 f(m3),
165 f(m4),
166 f(m5),
167 f(m6),
168 f(m7),
169 f(m8),
170 f(m9),
171 ]
172 }
173
174 /// Generates the Srgb to Xyz transformation matrix for a given white point.
175 #[inline]
176 pub fn rgb_to_xyz_matrixrust-analyzer cargo palette 0.7.6 matrix/rgb_to_xyz_matrix().<S, T>() -> Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T>
177 where
178 S: RgbSpacerust-analyzer cargo palette 0.7.6 rgb/RgbSpace#,
179 S::Primariesrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#Primaries#: Primariesrust-analyzer cargo palette 0.7.6 rgb/Primaries#<T>,
180 S::WhitePointrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#WhitePoint#: WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#<T>,
181 T: Reciprust-analyzer cargo palette 0.7.6 num/Recip# + IsValidDivisorrust-analyzer cargo palette 0.7.6 num/IsValidDivisor#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool> + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T>,
182 Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>: IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#<Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>>,
183 {
184 let r = S::Primariesrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#Primaries#::redrust-analyzer cargo palette 0.7.6 rgb/Primaries#red().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#into_color_unclamped().();
185 let g = S::Primariesrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#Primaries#::greenrust-analyzer cargo palette 0.7.6 rgb/Primaries#green().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#into_color_unclamped().();
186 let b = S::Primariesrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#Primaries#::bluerust-analyzer cargo palette 0.7.6 rgb/Primaries#blue().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#into_color_unclamped().();
187
188 let matrix = mat3_from_primariesrust-analyzer cargo palette 0.7.6 matrix/mat3_from_primaries().(r, g, b);
189
190 let s_matrix: Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S>, T> = multiply_xyz_to_rgbrust-analyzer cargo palette 0.7.6 matrix/multiply_xyz_to_rgb().(
191 matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse().(matrix.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().()),
192 S::WhitePointrust-analyzer cargo palette 0.7.6 rgb/RgbSpace#WhitePoint#::get_xyzrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#get_xyz().().with_white_pointrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]with_white_point().(),
193 );
194
195 // Destructuring has some performance benefits, don't change unless measured
196 let [t0, t1, t2, t3, t4, t5, t6, t7, t8] = matrix;
197
198 [
199 t0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.,
200 t1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.,
201 t2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.,
202 t3 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.,
203 t4 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.,
204 t5 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().&s_matrix.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.,
205 t6 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().s_matrix.redrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#red.,
206 t7 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().s_matrix.greenrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#green.,
207 t8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().s_matrix.bluerust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#blue.,
208 ]
209 }
210
211 #[rustfmt::skip]
212 #[inline]
213 fn mat3_from_primariesrust-analyzer cargo palette 0.7.6 matrix/mat3_from_primaries().<T>(r: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>, g: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>, b: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>) -> Mat3rust-analyzer cargo palette 0.7.6 matrix/Mat3#<T> {
214 [
215 r.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x., g.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x., b.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.,
216 r.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., g.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., b.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.,
217 r.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z., g.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z., b.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.,
218 ]
219 }
220
221 #[cfg(feature = "approx")]
222 #[cfg(test)]
223 mod testrust-analyzer cargo palette 0.7.6 matrix/test/ {
224 use superrust-analyzer cargo palette 0.7.6 matrix/::{matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse()., multiply_3x3rust-analyzer cargo palette 0.7.6 matrix/multiply_3x3()., multiply_xyzrust-analyzer cargo palette 0.7.6 matrix/multiply_xyz()., rgb_to_xyz_matrixrust-analyzer cargo palette 0.7.6 matrix/rgb_to_xyz_matrix().};
225 use craterust-analyzer cargo palette 0.7.6 crate/::chromatic_adaptationrust-analyzer cargo palette 0.7.6 chromatic_adaptation/::AdaptIntorust-analyzer cargo palette 0.7.6 chromatic_adaptation/AdaptInto#;
226 use craterust-analyzer cargo palette 0.7.6 crate/::encodingrust-analyzer cargo palette 0.7.6 encoding/::{Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#, Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#};
227 use craterust-analyzer cargo palette 0.7.6 crate/::rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#;
228 use craterust-analyzer cargo palette 0.7.6 crate/::white_pointrust-analyzer cargo palette 0.7.6 white_point/::D50rust-analyzer cargo palette 0.7.6 white_point/D50#;
229 use craterust-analyzer cargo palette 0.7.6 crate/::Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#;
230
231 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
232 fn matrix_multiply_3x3rust-analyzer cargo palette 0.7.6 matrix/test/matrix_multiply_3x3().() {
233 let inp1 = [1.0, 2.0, 3.0, 3.0, 2.0, 1.0, 2.0, 1.0, 3.0];
234 let inp2 = [4.0, 5.0, 6.0, 6.0, 5.0, 4.0, 4.0, 6.0, 5.0];
235 let expected = [28.0, 33.0, 29.0, 28.0, 31.0, 31.0, 26.0, 33.0, 31.0];
236
237 let computed = multiply_3x3rust-analyzer cargo palette 0.7.6 matrix/multiply_3x3().(inp1, inp2);
238 for (t1, t2) in expected.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(computed.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
239 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(t1, t2);
240 }
241 }
242
243 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
244 fn matrix_multiply_xyzrust-analyzer cargo palette 0.7.6 matrix/test/matrix_multiply_xyz().() {
245 let inp1 = [0.1, 0.2, 0.3, 0.3, 0.2, 0.1, 0.2, 0.1, 0.3];
246 let inp2 = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::newrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]new().(0.4, 0.6, 0.8);
247
248 let expected = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::newrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]new().(0.4, 0.32, 0.38);
249
250 let computed = multiply_xyzrust-analyzer cargo palette 0.7.6 matrix/multiply_xyz().(inp1, inp2);
251 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(expected, computed)
252 }
253
254 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
255 fn matrix_inverse_check_1rust-analyzer cargo palette 0.7.6 matrix/test/matrix_inverse_check_1().() {
256 let input: [f64; 9] = [3.0, 0.0, 2.0, 2.0, 0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().2.0, 0.0, 1.0, 1.0];
257
258 let expected: [f64; 9] = [0.2, 0.2, 0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().0.2, 0.3, 1.0, 0.2, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().0.3, 0.0];
259 let computed = matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse().(input);
260 for (t1, t2) in expected.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(computed.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
261 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(t1, t2);
262 }
263 }
264 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
265 fn matrix_inverse_check_2rust-analyzer cargo palette 0.7.6 matrix/test/matrix_inverse_check_2().() {
266 let input: [f64; 9] = [1.0, 0.0, 1.0, 0.0, 2.0, 1.0, 1.0, 1.0, 1.0];
267
268 let expected: [f64; 9] = [-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0, 2.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().1.0, 0.0, 1.0, 2.0, 1.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().2.0];
269 let computed = matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse().(input);
270 for (t1, t2) in expected.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(computed.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
271 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(t1, t2);
272 }
273 }
274 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
275 #[should_panic]
276 fn matrix_inverse_panicrust-analyzer cargo palette 0.7.6 matrix/test/matrix_inverse_panic().() {
277 let input: [f64; 9] = [1.0, 0.0, 0.0, 2.0, 0.0, 0.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().4.0, 6.0, 1.0];
278 matrix_inverserust-analyzer cargo palette 0.7.6 matrix/matrix_inverse().(input);
279 }
280
281 #[rustfmt::skip]
282 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
283 fn d65_rgb_conversion_matrixrust-analyzer cargo palette 0.7.6 matrix/test/d65_rgb_conversion_matrix().() {
284 let expected = [
285 0.4124564, 0.3575761, 0.1804375,
286 0.2126729, 0.7151522, 0.0721750,
287 0.0193339, 0.1191920, 0.9503041
288 ];
289 let computed = rgb_to_xyz_matrixrust-analyzer cargo palette 0.7.6 matrix/rgb_to_xyz_matrix().::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, f64>();
290 for (e, c) in expected.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(computed.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()) {
291 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(e, c, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001)
292 }
293 }
294
295 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
296 fn d65_to_d50rust-analyzer cargo palette 0.7.6 matrix/test/d65_to_d50().() {
297 let input: Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#>> = Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 1.0, 1.0);
298 let expected: Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<(Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, D50rust-analyzer cargo palette 0.7.6 white_point/D50#)>> = Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 1.0, 1.0);
299
300 let computed: Rgbrust-analyzer cargo palette 0.7.6 rgb/rgb/Rgb#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<(Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, D50rust-analyzer cargo palette 0.7.6 white_point/D50#)>> = input.adapt_intorust-analyzer cargo palette 0.7.6 chromatic_adaptation/AdaptInto#adapt_into().();
301 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(expected, computed, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.000001);
302 }
303 }