tests/cuda4.1sdk/tests/eigenvalues/matlab.cpp
void
writeTridiagSymMatlab( const char* filename,
                       float* d, float* s, 
                       float* eigenvals, 
                       const unsigned int n )
{
  std::ofstream file( filename, std::ios::out);

  // write diagonal entries
  writeVectorMatlab( file, "d", d, n);

  // write superdiagonal entries
  writeVectorMatlab( file, "s", s, n-1);

  // write eigenvalues
  writeVectorMatlab( file, "eigvals", eigenvals, n);

  file.close();
}
///////////////////////////////////////////////////////////////////////////////
//! Write a tridiagonal, symmetric matrix in vector representation and
//! it's eigenvalues
//! @param  filename  name of output file
//! @param  d  diagonal entries of the matrix
//! @param  s  superdiagonal entries of the matrix (len = n - 1)
//! @param  eigenvals  eigenvalues of the matrix
//! @param  indices  vector of len n containing the position of the eigenvalues
//!                  if these are sorted in ascending order
//! @param  n  size of the matrix
///////////////////////////////////////////////////////////////////////////////
Write a tridiagonal, symmetric matrix in vector representation and
it's eigenvalues
Write a tridiagonal symmetric matrix in vector representation and it ' s eigenvalues
void
writeTridiagSymMatlab( const char* filename,
                       float* d, float* s, 
                       float* eigenvals, 
                       const unsigned int n )
{
  std::ofstream file( filename, std::ios::out);
  writeVectorMatlab( file, "d", d, n);
  writeVectorMatlab( file, "s", s, n-1);
  writeVectorMatlab( file, "eigvals", eigenvals, n);
  file.close();
}
void writeTridiagSymMatlab ( const char * filename , float * d , float * s , float * eigenvals , const unsigned int n ) { std :: ofstream file ( filename , std :: ios :: out ) ; writeVectorMatlab ( file , " " , d , n ) ; writeVectorMatlab ( file , " " , s , n - 1 ) ; writeVectorMatlab ( file , " " , eigenvals , n ) ; file . close ( ) ; }
Write a tridiagonal, symmetric matrix in vector representation and
it's eigenvalues
Write a tridiagonal symmetric matrix in vector representation and it ' s eigenvalues
// write diagonal entries // write superdiagonal entries // write eigenvalues