Conditionally use fma
This commit is contained in:
parent
7ab6f311c1
commit
75338698a4
|
@ -6,5 +6,6 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
approx = { version = "0.4.0", optional = true }
|
||||
cfg-if = "1.0.0"
|
||||
float = { path = "../float" }
|
||||
num-traits = "0.2.14"
|
||||
|
|
|
@ -131,7 +131,13 @@ impl<const M: usize, const P: usize> Matrix<Float, M, P> {
|
|||
lhs[(i, 0)] * rhs[(0, j)]
|
||||
};
|
||||
for k in 1..N {
|
||||
cfg_if::cfg_if!(
|
||||
if #[cfg(target_feature="fma")] {
|
||||
t = Float::mul_add(lhs[(i, k)], rhs[(k, j)], t);
|
||||
} else {
|
||||
t = t + lhs[(i, k)]*rhs[(k, j)];
|
||||
}
|
||||
);
|
||||
}
|
||||
self[(i, j)] = t;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue