-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
87 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
//! Methods on Matrix types that require an underlying base matrix. | ||
use crate::matrix::Matrix; | ||
use crate::data_container::DataContainerMut; | ||
use crate::traits::*; | ||
use crate::types::*; | ||
use crate::base_matrix::*; | ||
use crate::data_container::{DataContainerMut}; | ||
use rand::prelude::*; | ||
use rand_distr::StandardNormal; | ||
|
||
use super::GenericBaseMatrixMut; | ||
|
||
impl<Item: Scalar, | ||
L: LayoutType, | ||
RS: SizeIdentifier, | ||
CS: SizeIdentifier, | ||
Data: DataContainerMut<Item=Item>> | ||
GenericBaseMatrixMut<Item, L, Data, RS, CS>{ | ||
|
||
pub fn for_each<F: FnMut(&mut Item)>(&mut self, mut f: F) { | ||
for index in 0..self.layout().number_of_elements() { | ||
unsafe {f(self.get1d_unchecked_mut(index))} | ||
} | ||
} | ||
|
||
} | ||
|
||
impl< | ||
Item: Scalar, | ||
L: LayoutType, | ||
RS: SizeIdentifier, | ||
CS: SizeIdentifier, | ||
Data: DataContainerMut<Item = Item>, | ||
> GenericBaseMatrixMut<Item, L, Data, RS, CS> | ||
{ | ||
pub fn for_each<F: FnMut(&mut Item)>(&mut self, mut f: F) { | ||
for index in 0..self.layout().number_of_elements() { | ||
unsafe { f(self.get1d_unchecked_mut(index)) } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters