AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
aud.test.SparseMatrixCSTest Class Reference

Public Member Functions

void testMatrix ()
 

Static Public Member Functions

static void main (String args[])
 

Detailed Description

Definition at line 9 of file SparseMatrixCSTest.java.

Member Function Documentation

◆ main()

static void aud.test.SparseMatrixCSTest.main ( String  args[])
static

Definition at line 59 of file SparseMatrixCSTest.java.

59 {
60 org.junit.runner.JUnitCore.main("aud.test.SparseMatrixCSTest");
61 }

◆ testMatrix()

void aud.test.SparseMatrixCSTest.testMatrix ( )

Definition at line 12 of file SparseMatrixCSTest.java.

12 {
13 SparseMatrixCS<Integer> m=new SparseMatrixCS<Integer>();
14 assertSame(m.nnz(),0);
15 assertSame(m.getNumRows(),0);
16 assertSame(m.getNumColumns(),0);
17 assertSame(m.getMinRowIndex(),0);
18 assertSame(m.getMinColumnIndex(),0);
19
20 m.set(2,2,2);
21 m.set(9,9,9);
22
23 assertSame(m.getNumRows(),9);
24 assertSame(m.getNumColumns(),9);
25 assertSame(m.getMinRowIndex(),2);
26 assertSame(m.getMinColumnIndex(),2);
27
28 assertSame(m.get(2,2),2);
29 assertSame(m.get(9,9),9);
30 assertSame(m.nnz(),2);
31
32 m.set(2,2,3);
33 assertSame(m.get(2,2),3);
34 assertSame(m.nnz(),2);
35
36 m.set(2,2,null);
37 assertSame(m.get(2,2),null);
38 assertSame(m.nnz(),1);
39
40 m.set(2,2,2);
41
42 m.set(4,2,-1);
43 assertSame(m.get(4,2),-1);
44 assertSame(m.get(2,4),null);
45
46 int[] ri=m.getColumnRowIndices(2);
47 Vector<Integer> v=m.getColumnEntries(2);
48
49 assertSame(ri.length,2);
50 assertSame(m.columnDegree(2),2);
51 assertSame(ri[0],2);
52 assertSame(ri[1],4);
53 assertEquals(v.at(0),Integer.valueOf(2));
54 assertEquals(v.at(1),Integer.valueOf(-1));
55
56 assertSame(m.spones().nnz(),m.nnz());
57 }

References aud.Vector< T >.at(), aud.graph.matrix.SparseMatrixCS< T >.columnDegree(), aud.graph.matrix.SparseMatrixCS< T >.get(), aud.graph.matrix.SparseMatrixCS< T >.getColumnEntries(), aud.graph.matrix.SparseMatrixCS< T >.getColumnRowIndices(), aud.graph.matrix.SparseMatrixCS< T >.getMinColumnIndex(), aud.graph.matrix.SparseMatrixCS< T >.getMinRowIndex(), aud.graph.matrix.SparseMatrixCS< T >.getNumColumns(), aud.graph.matrix.SparseMatrixCS< T >.getNumRows(), aud.graph.matrix.SparseMatrixCS< T >.nnz(), aud.graph.matrix.SparseMatrixCS< T >.set(), and aud.graph.matrix.SparseMatrixCS< T >.spones().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: