Revision: 38794
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38794
Author:   elubie
Date:     2011-07-28 18:18:55 +0000 (Thu, 28 Jul 2011)
Log Message:
-----------
Cleanup:
* Converting spaces to tabs. Shuvro, please set your editor to use tabs for 
indentation!
* svn properties

Modified Paths:
--------------
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h
    branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.h
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolverArpack.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolverArpack.h

Property Changed:
----------------
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.h
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolverArpack.cpp
    branches/soc-2011-avocado/blender/intern/autoseam/EigenSolverArpack.h

Modified: 
branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp     
2011-07-28 15:51:59 UTC (rev 38793)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.cpp     
2011-07-28 18:18:55 UTC (rev 38794)
@@ -52,8 +52,8 @@
 {
        m_adjacency = MatrixXd::Zero(dimension, dimension);
        m_index_map_vector.resize(dimension, -1);
-    mul_vec     = Eigen::VectorXd(dimension);
-    matrix_dimension = dimension;
+       mul_vec     = Eigen::VectorXd(dimension);
+       matrix_dimension = dimension;
        //threshold_value = min_value;
 }
 
@@ -61,7 +61,6 @@
 {
        m_adjacency(row, col) = value;
        m_adjacency(col, row) = value;
-   
 }
 
 void AutoseamAdjacency::set_min_value(float min_value)
@@ -123,34 +122,34 @@
 
 bool AutoseamAdjacency::generate_seam()
 {
-    
-    double *eigen_vectors;
+       
+       double *eigen_vectors;
        MatrixXd& a = m_adjacency;
        
        clear_eigenspaces();
-    
-        
+       
+               
        int n = a.rows();
-    
+       
        for (int i=0; i<n;++i) {
                a(i,i) = 0.0;
                double rowsum = a.row(i).sum();
                a(i,i) = -rowsum;
        }
-    
-    //eigen_vectors = calculate_eigen_arpack();
-    
+       
+       //eigen_vectors = calculate_eigen_arpack();
+       
 
-    // Need to modify the errors of the commented code.
-    
-    EigenSolverArpack solver(matrix_dimension);
-    solver.matrix =  a;
-    eigen_vectors = solver.calculate_eigen_space();
+       // Need to modify the errors of the commented code.
        
-    
-    //dssimp_();
+       EigenSolverArpack solver(matrix_dimension);
+       solver.matrix =  a;
+       eigen_vectors = solver.calculate_eigen_space();
        
-    if(a.rows() && a.cols() && eigen_vectors != NULL){
+       
+       //dssimp_();
+       
+       if(a.rows() && a.cols() && eigen_vectors != NULL){
                
                //Eigen::SelfAdjointEigenSolver<MatrixXd> es(a);
                //Eigen::VectorXd evalues(es.eigenvalues());
@@ -161,34 +160,34 @@
                MatrixXd aminus;
        
                //while ( (f < num_eigen_values)) {
-        while ( (f < solver.num_eigen_vectors)) {
+               while ( (f < solver.num_eigen_vectors)) {
                        // Eigenvalues seem to be sorted largest to smallest, 
we need the 30 smallest
                        // in the future only those will be calculated by the 
algorithm (if we use ARPACK)
                        
-            //if(fabs(eigen_values[n-f-1]) > 0.0005){
-            //if(fabs(eigen_values[f]) > 0.0005){
-            
-            printf("eigen values: %f\n", fabs(solver.eigen_values[f]));
-            if(fabs(solver.eigen_values[f]) > 0.0005){
-                
-                int loop;
-                //now construct a vector with the values
-                Eigen::VectorXd eigen_vector = 
Eigen::VectorXd(matrix_dimension);
-                
-                for(loop = 0; loop < matrix_dimension; loop++){
-                    // This hardcoded value will be removed later
-                    eigen_vector(loop) = *(eigen_vectors + f*matrix_dimension 
+ loop);
-                }
-                
+                       //if(fabs(eigen_values[n-f-1]) > 0.0005){
+                       //if(fabs(eigen_values[f]) > 0.0005){
+                       
+                       printf("eigen values: %f\n", 
fabs(solver.eigen_values[f]));
+                       if(fabs(solver.eigen_values[f]) > 0.0005){
                                
+                               int loop;
+                               //now construct a vector with the values
+                               Eigen::VectorXd eigen_vector = 
Eigen::VectorXd(matrix_dimension);
+                               
+                               for(loop = 0; loop < matrix_dimension; loop++){
+                                       // This hardcoded value will be removed 
later
+                                       eigen_vector(loop) = *(eigen_vectors + 
f*matrix_dimension + loop);
+                               }
+                               
+                               
                                //AutoseamEigenspace* aes = new 
AutoseamEigenspace(evalues[n-f-1], es.eigenvectors().col(n-f-1));
-                //AutoseamEigenspace* aes = new 
AutoseamEigenspace(eigen_values[f], eigen_vector);
-                AutoseamEigenspace* aes = new 
AutoseamEigenspace(solver.eigen_values[f], eigen_vector);
+                               //AutoseamEigenspace* aes = new 
AutoseamEigenspace(eigen_values[f], eigen_vector);
+                               AutoseamEigenspace* aes = new 
AutoseamEigenspace(solver.eigen_values[f], eigen_vector);
                                // split Eigenspace into two subspaces F+ and 
F- where the ith entry in the eigenvector is positive/negative
                                aes->split();
                                aes->fill_adjacency(a, aplus, aminus);
                        
-//                printf("four values are: %d %d %d %d", aplus.rows(), 
aplus.cols(), aminus.rows(), aminus.cols());
+                               // printf("four values are: %d %d %d %d", 
aplus.rows(), aplus.cols(), aminus.rows(), aminus.cols());
                                // We filter out eigenspaces that give 
non-connected F+ and F- as in the paper
                                if ((is_graph_connected(aplus, threshold_value) 
&& is_graph_connected(aminus, threshold_value))) {
                                        m_eigenspaces.push_back(aes);
@@ -201,12 +200,12 @@
                        }
                        f++;
                }
-        
-        MEM_freeN(eigen_vectors);
+               
+               MEM_freeN(eigen_vectors);
                return found;
        }
-    
-    MEM_freeN(eigen_vectors);
+       
+       MEM_freeN(eigen_vectors);
        return 0;
 }
 
@@ -216,7 +215,7 @@
 }
 
 void AutoseamAdjacency::get_split(int n, int *fplus, unsigned int* nplus, int* 
fminus, unsigned int* nminus)
-{   
+{
        int i;
        int face_index;
        
@@ -283,4 +282,4 @@
                AutoseamEigenspace* aes = m_eigenspaces[i];
                aes->debug(fout);
        }
-}
\ No newline at end of file
+}

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h       
2011-07-28 15:51:59 UTC (rev 38793)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamAdjacency.h       
2011-07-28 18:18:55 UTC (rev 38794)
@@ -55,18 +55,18 @@
                float get_value(int row, int col);
        
                void debug(std::ofstream& fout);
-        
+               
        private:
                Eigen::MatrixXd m_adjacency;
                std::vector<AutoseamEigenspace*> m_eigenspaces;
                std::vector<int> m_index_map_vector;
                float threshold_value;
                //map<int,int> m_index_map;
-        Eigen::VectorXd mul_vec;
-        int num_eigen_values;
-        int matrix_dimension;
-        
-    
+               Eigen::VectorXd mul_vec;
+               int num_eigen_values;
+               int matrix_dimension;
+               
+       
 };
 
 #endif

Modified: branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp       
2011-07-28 15:51:59 UTC (rev 38793)
+++ branches/soc-2011-avocado/blender/intern/autoseam/AutoseamUtility.cpp       
2011-07-28 18:18:55 UTC (rev 38794)
@@ -72,12 +72,11 @@
        m_A <<  1.0f, 2.0f, 0.0f,
                        0.0f, 2.0f, 3.0f,
                        0.0f, 0.0f, 3.0f;
-    
+       
 }
 
 static double row_sum(MatrixXd matrix, int dimension, int row_index) {
        double result = 0.0 ;
-   
 
        for (int i = 0; i < dimension; i++) {
                result += matrix(row_index, i);
@@ -90,9 +89,8 @@
 
 void AutoseamUtility::calculate_eigen(float **dual_matrix, int num_row, int 
num_col, float **eigen_vectors, float *eigen_values)
 {
-    int i,l,r_index,c_index;
+       int i,l,r_index,c_index;
        dualMatrix.resize(num_row, num_col);
-   
        
        /* we can print the matrix here to have a look */
        
@@ -111,15 +109,15 @@
                dualMatrix(l,l) = - row_sum(dualMatrix, num_row, l);
        }
 
-   // we need to replace this portion with our eigen generation code
-   Eigen::EigenSolver<MatrixXd> es(dualMatrix);
-   std::cout << "The eigenvalues of A are:" << std::endl << es.eigenvalues() 
<< std::endl;
+       // we need to replace this portion with our eigen generation code
+       Eigen::EigenSolver<MatrixXd> es(dualMatrix);
+       std::cout << "The eigenvalues of A are:" << std::endl << 
es.eigenvalues() << std::endl;
        
        
-    /**
-     * Pack the calculated eigen vectors and eigen values to 
-     * eigen_vectors and eigen_values.
-     */
+       /**
+        * Pack the calculated eigen vectors and eigen values to 
+        * eigen_vectors and eigen_values.
+        */
        
        for(i = 0; i < num_col; i++ )
        {

Modified: branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp   
2011-07-28 15:51:59 UTC (rev 38793)
+++ branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp   
2011-07-28 18:18:55 UTC (rev 38794)
@@ -1,4 +1,4 @@
-/* $Id: AutoseamAdjacency.cpp 38737 2011-07-26 16:37:38Z shuvro $ 
+/* $Id$ 
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -32,27 +32,26 @@
 
 EigenSolver::EigenSolver(int dimension)
 {
-    matrix_dimension  = dimension;
-    //num_eigen_vectors = eigen_vectors;
-    
-    // Allocate memories for eigenspace
-    
+       matrix_dimension  = dimension;
+       //num_eigen_vectors = eigen_vectors;
+       
+       // Allocate memories for eigenspace
+       
 }
 
 int EigenSolver::multiply_matrix_vector(int dimension, double *result, double 
*input)
 {
-    for (int i = 0; i < A.n ; i++) {
-        *(result + i) = 0.0;
-    }
-    
-    for (int k = 0; k < A.nnz; k++) {
-        *(result + A.i[k]) += A.v[k] *  (*(input + A.j[k]));
-    }
-    
-    return 0;
+       for (int i = 0; i < A.n ; i++) {
+               *(result + i) = 0.0;
+       }
+       
+       for (int k = 0; k < A.nnz; k++) {
+               *(result + A.i[k]) += A.v[k] *  (*(input + A.j[k]));
+       }
+       
+       return 0;
 }
 
 EigenSolver::~EigenSolver()
 {
-   
 }


Property changes on: 
branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.cpp
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.h
===================================================================
--- branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.h     
2011-07-28 15:51:59 UTC (rev 38793)
+++ branches/soc-2011-avocado/blender/intern/autoseam/EigenSolver.h     
2011-07-28 18:18:55 UTC (rev 38794)
@@ -1,4 +1,4 @@
-/* $Id: AutoseamAdjacency.h 38650 2011-07-24 05:24:46Z shuvro $ 
+/* $Id$ 
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -30,33 +30,33 @@
 #define EIGEN_SOLVER_H
 
 struct SparseMatrix{
-    int n;      // matrix dimension
-    int nnz;    // number of non-zero coefficients
-    int *i;     // row indices, array of size nnz;
-    int *j;     // column indices, array of size nnz;
-    double *v;  // non-zero coefficients, array of size nnz;
+       int n;      // matrix dimension
+       int nnz;    // number of non-zero coefficients
+       int *i;     // row indices, array of size nnz;
+       int *j;     // column indices, array of size nnz;
+       double *v;  // non-zero coefficients, array of size nnz;
 };
 
 class EigenSolver{
-    
-    protected:
-        SparseMatrix A;
-        bool is_allocated;
-        int  matrix_dimension;

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to