src/dense_cpu.c
void calculate_eigen_values ( int N, void* DATA, int NEV, float* eigenvalues, float* eigenvectors, char* which )
{
    int use_N_ev = 2*NEV;
    if ( use_N_ev > ( N/2 - 1 ) )
        use_N_ev = N/2 - 1;
    // select the number of Arnoldi vectors to generate
    int NCV = 2*use_N_ev + 1;
    if ( NCV > N )
        NCV = N;

    // allocate temporary storage for the vectors
    float* temp_ev = (float*)malloc ( NCV*2*sizeof(float) );
    float* temp_vectors = (float*) malloc (N*NCV*sizeof(float));
    float* temp_residuals = (float*)malloc ( (NCV )*sizeof(float));

    // solve the eigenvalue problem using ARPACK
    arpack_ssev(N, (void*)DATA, use_N_ev, NCV, temp_ev, temp_vectors, temp_residuals, which );
    
    // Copy the resultant eigenvalues to the previously allocated space.
    memcpy(eigenvalues, temp_ev, NEV*2*sizeof(float));
    memcpy(eigenvectors, temp_vectors, NEV*N*sizeof(float));

    // free the temporary storage
    free ( temp_ev );
    free ( temp_vectors );
    free ( temp_residuals );
}
//!
//! Solve the actual eigensystem. This takes the eigensystem defined in the structure DATA and allocates
//! the required temporary workspaces before calling the Fortran backend.
Solve the actual eigensystem. This takes the eigensystem defined in the structure DATA and allocates
the required temporary workspaces before calling the Fortran backend.
Solve the actual eigensystem . This takes the eigensystem defined in the structure DATA and allocates the required temporary workspaces before calling the Fortran backend .
void calculate_eigen_values ( int N, void* DATA, int NEV, float* eigenvalues, float* eigenvectors, char* which )
{
    int use_N_ev = 2*NEV;
    if ( use_N_ev > ( N/2 - 1 ) )
        use_N_ev = N/2 - 1;
    int NCV = 2*use_N_ev + 1;
    if ( NCV > N )
        NCV = N;
    float* temp_ev = (float*)malloc ( NCV*2*sizeof(float) );
    float* temp_vectors = (float*) malloc (N*NCV*sizeof(float));
    float* temp_residuals = (float*)malloc ( (NCV )*sizeof(float));
    arpack_ssev(N, (void*)DATA, use_N_ev, NCV, temp_ev, temp_vectors, temp_residuals, which );
    memcpy(eigenvalues, temp_ev, NEV*2*sizeof(float));
    memcpy(eigenvectors, temp_vectors, NEV*N*sizeof(float));
    free ( temp_ev );
    free ( temp_vectors );
    free ( temp_residuals );
}
void calculate_eigen_values ( int N , void * DATA , int NEV , float * eigenvalues , float * eigenvectors , char * which ) { int use_N_ev = 2 * NEV ; if ( use_N_ev > ( N / 2 - 1 ) ) use_N_ev = N / 2 - 1 ; int NCV = 2 * use_N_ev + 1 ; if ( NCV > N ) NCV = N ; float * temp_ev = ( float * ) malloc ( NCV * 2 * sizeof ( float ) ) ; float * temp_vectors = ( float * ) malloc ( N * NCV * sizeof ( float ) ) ; float * temp_residuals = ( float * ) malloc ( ( NCV ) * sizeof ( float ) ) ; arpack_ssev ( N , ( void * ) DATA , use_N_ev , NCV , temp_ev , temp_vectors , temp_residuals , which ) ; memcpy ( eigenvalues , temp_ev , NEV * 2 * sizeof ( float ) ) ; memcpy ( eigenvectors , temp_vectors , NEV * N * sizeof ( float ) ) ; free ( temp_ev ) ; free ( temp_vectors ) ; free ( temp_residuals ) ; }
Solve the actual eigensystem.
Solve the actual eigensystem .
// select the number of Arnoldi vectors to generate // allocate temporary storage for the vectors // solve the eigenvalue problem using ARPACK // Copy the resultant eigenvalues to the previously allocated space. // free the temporary storage