Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  eigtst.c

  Sprache: C
 

/* Test program for eigens.c
 */


#define N 11
#define DEBUG 0
static double A[N*N], A0[N*N], X[N*N], D[N*N];
static double RR[N*N];
static double B[N], Y[N];
static int IPS[N];
double maxoffd(), sqrt();

main()
{
long ntrials;
int i, j, k;
double x, e, merr;

merr = 0.0;
ntrials = 0;

loop:

/* Fill A[] with random numbers */
k = N*(N+1)/2;
for( i=0; i<k; i++ )
 {
 drand( &x );
 x -= 1.5;
 x = x + x;
 A[i] = x;
 }
/* Unpack A into a symmetric matrix A0 */
tritosquare( N, A, A0 );

eigens( A, RR, B, N );
mtransp( N, RR, RR );

#if DEBUG
/* Print the computed eigenvalues */
for( i=0; i<N; i++ )
 printf( "%6.2f", B[i] );
/* Print the reduced triangular matrix */
printf( "\n" );
k = 0;
for( i=0; i<N; i++ )
 {
 for( j=0; j<=i; j++ )
  {
  printf( "%6.2f", A[k] );
  k += 1;
  }
 printf( "\n" );
 }

/* Print the original symmetric matrix */
printf( "\n" );
for( i=0; i<N; i++ )
 {
 for( j=0; j<N; j++ )
  printf( "%6.2f", A0[N*i+j] );
 printf( "\n" );
 }

/* Print the matrix of eigenvectors */
printf( "\n" );
for( i=0; i<N; i++ )
 {
 for( j=0; j<N; j++ )
  printf( "%6.2f", RR[N*i+j] );
 printf( "\n" );
 }

#endif

/* Multiply the original matrix by the eigenvectors */
mmmpy( N, N, A0, RR, D );
/* Divide each result vector by the corresponding eigenvalue. */
k = 0;
for( i=0; i<N; i++ )
 {
 x = B[i];
 for( j=0; j<N; j++ )
  {
  D[k] /= x;
  k += 1;
  }
 }

#if DEBUG
printf( "\n" );
for( i=0; i<N; i++ )
 {
 for( j=0; j<N; j++ )
  printf( "%6.2f", D[N*i+j] );
 printf( "\n" );
 }
#endif

/* Compare the result with the computed eigenvector */
mtransp( N, D, D );
e = 0.0;
for( i=0; i<N*N; i++ )
 {
 x = D[i] - RR[i];
 if( x < 0 )
  x = -x;
 if( x > e )
  e = x;
 }
if( e > merr )
 merr = e;
ntrials += 1;
printf( "%4ld %.3e\n", ntrials, merr );
goto loop;
}

Messung V0.5 in Prozent
C=92 H=4 G=64

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-06-14) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik