Skip to content

Commit

Permalink
Add type annotation required by rustc 2015-03-31
Browse files Browse the repository at this point in the history
Resolves this error, which is fallout from
rust-lang/rust#23673:

src/structs/dmat.rs:501:43: 501:74 error: type annotations required: cannot resolve `<f64 as core::ops::Div<_>>::Output == f64` [E0284]
src/structs/dmat.rs:501         let normalizer: N    = Cast::from(1.0f64 / Cast::from(self.nrows));
                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Mar 31, 2015
1 parent 1fc59cb commit 48d8bef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/structs/dmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,8 @@ impl<N: Clone + Copy> Transpose for DMat<N> {
impl<N: BaseNum + Cast<f64> + Clone> Mean<DVec<N>> for DMat<N> {
fn mean(&self) -> DVec<N> {
let mut res: DVec<N> = DVec::new_zeros(self.ncols);
let normalizer: N = Cast::from(1.0f64 / Cast::from(self.nrows));
let nrows_f64: f64 = Cast::from(self.nrows);
let normalizer: N = Cast::from(1.0f64 / nrows_f64);

for i in 0..self.nrows {
for j in 0..self.ncols {
Expand Down

0 comments on commit 48d8bef

Please sign in to comment.