EigenSolver.emam 641 Bytes
Newer Older
Bernhard Rumpe's avatar
BR-sy    
Bernhard Rumpe committed
1
/* (c) https://github.com/MontiCore/monticore */
Jean-Marc Ronck's avatar
Jean-Marc Ronck committed
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
package detection;

 

component EigenSolver<N1 n = 2500,N1 targetEigenvectors = 4> {

    ports in Q(-oo:oo)^{n,n} matrix,

          out Q(-oo:oo)^{n,targetEigenvectors} eigenvectors;

 

    implementation Math{

        //calculate requested amount of eigenvectors if present

        Q^{n,n} eigenVectors = eigvec(matrix);

 

        Q counter = 1;

        Q start = size(eigenVectors,2) - ( targetEigenvectors - 1 );

        for i = start : size(eigenVectors,1)

                eigenvectors(:,counter) = eigenVectors(:,i);

            counter = counter + 1;

        end

    }

Bernhard Rumpe's avatar
BR-sy    
Bernhard Rumpe committed
36
}