-
Notifications
You must be signed in to change notification settings - Fork 0
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
8 changed files
with
49 additions
and
51 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
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,38 +1,26 @@ | ||
use sprs::{CsVec, CsMat, CsMatBase}; | ||
use sprs::{CsMat, TriMat}; | ||
|
||
use crate::storage::ZarrArray; | ||
|
||
use super::{EngineResult, EngineStrategy}; | ||
|
||
impl EngineStrategy<CsVec<u8>> for ZarrArray { | ||
fn get_subject(&self, index: usize) -> EngineResult<CsVec<u8>> { | ||
let selection = CsVec::new(self.rows(), vec![index], vec![1]); | ||
Ok(&self.transpose_view() * &selection) | ||
impl EngineStrategy<CsMat<u8>> for ZarrArray { | ||
fn get_subject(&self, index: usize) -> EngineResult<CsMat<u8>> { | ||
let mut matrix = TriMat::new((self.rows(), self.rows())); | ||
matrix.add_triplet(index, index, 1); | ||
let matrix = matrix.to_csc(); | ||
Ok(&matrix * self) | ||
} | ||
|
||
fn get_predicate(&self, index: usize) -> EngineResult<CsMat<u8>> { | ||
|
||
|
||
let mut rows: Vec<usize> = vec![]; | ||
let mut cols: Vec<usize> = vec![]; | ||
let mut values: Vec<u8> = vec![]; | ||
let iterator = self.into_iter(); | ||
for value in iterator { | ||
if *value.0 == index as u8 { | ||
rows.push(value.1.0); | ||
cols.push(value.1.1); | ||
values.push(*value.0); | ||
} | ||
|
||
} | ||
//CsMatBase<u8, usize, Vec<usize>, Vec<usize>, Vec<u8>> | ||
let result = CsMat::new(self.shape(),rows, cols, values); | ||
fn get_predicate(&self, value: u8) -> EngineResult<CsMat<u8>> { | ||
Check warning on line 15 in src/engine/array.rs GitHub Actions / Check (stable)
Check warning on line 15 in src/engine/array.rs GitHub Actions / Test Suite (stable)
|
||
|
||
Ok(result) | ||
unimplemented!() | ||
} | ||
|
||
fn get_object(&self, index: usize) -> EngineResult<CsVec<u8>> { | ||
let selection = CsVec::new(self.cols(), vec![index], vec![1]); | ||
Ok(self * &selection) | ||
fn get_object(&self, index: usize) -> EngineResult<CsMat<u8>> { | ||
let mut matrix = TriMat::new((self.cols(), self.cols())); | ||
matrix.add_triplet(index, index, 1); | ||
let matrix = matrix.to_csc(); | ||
Ok(self * &matrix) | ||
} | ||
} |
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
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
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