1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pub mod dense_row_major;
pub mod sparse_crs;
pub mod sparse_dok;


pub trait BasicReadableMatrix {

    /// returns the number of rows
	fn get_rows(&self) -> usize;

    /// returns the number of columns
    fn get_columns(&self) -> usize;

    /// returns the (i,j)-th element of the matrix
    fn get_element(&self, i: usize, j: usize)-> f32;

}


pub trait BasicWriteableMatrix {

    /// sets the (i,j)-th element
	fn set_element(&mut self, i: usize, j: usize, value: f32);

    /// sets all elements to zero
    fn set_zero(&mut self);

}


pub trait SparseMatrix {

    /// returns the number of non-null matrix elements
    fn nnz(&self) -> usize;

}