Choose your eigenvalues

Linear Algebra and the C Language · Wikibooks

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From Wikibooks, under CC BY-SA 4.0, as the source states it. This page at Wikibooks.

    Choose your eigenvalues


    Choose your eigenvalues

    Introduce the values for the eigenvalues on the diagonal

    /* ------------------------------------ */ 
    double d[RCA*RCA] ={   
      +1, +0,   +0,  +0,   +0,   +0,
      +0, +1,   +0,  +0,   +0,   +0,       
      +0, +0,   +1,  +0,   +0,   +0, 
      +0, +0,   +0,  +1,   +0,   +0, 
      +0, +0,   +0,  +0,   +1,   +0, 
      +0, +0,   +0,  +0,   +0,   +0          
    };
    
    double **D      =         ca_A_mR(d, i_mR(RCA,RCA));        
    /* ------------------------------------ */
    

    With this function you can choose the values of your eigenvalues.

    /* ------------------------------------ */
    double **rdefpos_diag_mR(
    double **D,                                    /* Choose your eigenvalues         */
    double **A,
    int      n                                     /* Control the function: r_Q_mR(); */   
    )
    {
    int r = rsize_R(A);
    
    double **Q    =   r_Q_mR(     i_mR(r,r),n);      /* You create an orthogonal matrix. */
    double **invQ = invgj_mR(Q,   i_mR(r,r));        /* You take its inverse.            */
    double **QD   =   mul_mR(Q,D, i_mR(r,r));        /* You compute:  A = Q D invQ       */
    
    /*                    A = Q D invQ */
             mul_mR(QD,invQ,A);
    
      f_mR(Q);
      f_mR(invQ);
      f_mR(QD);
      
     return(A);
    }
    /* ------------------------------------ */
    


    Application

    You can choose the values of the eigenvalues with the function: rdefpos_diag_mR();

    Let's check the result

    An example: