⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocn_f06.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 5 页
字号:
      printf("       ");
      printf("(%f,%fi)\n",vec_input[i].m_re,vec_input[i].m_im);
   }

   printf("\n");                       //output vec_output
   printf("Result vector=\n");
   for(i=0;i<nRowCol;i++)
   {
      printf("       ");
      printf("(%f,%fi)\n",vec_output[i].m_re,vec_output[i].m_im);
   }
}

   The output is as following:
Compute a matrix-vector product for complex Hermitian band matrix M*V:
M=
       (1.000000,0.000000i)    (2.000000,2.100000i)    (0.000000,0.000000i)    (0.000000,0.000000i)    
       (2.000000,-2.100000i)    (5.000000,0.000000i)    (6.000000,2.600000i)    (0.000000,0.000000i)    
       (0.000000,0.000000i)    (6.000000,-2.600000i)    (9.000000,0.000000i)    (10.000000,2.000000i)    
       (0.000000,0.000000i)    (0.000000,0.000000i)    (10.000000,-2.000000i)    (11.000000,0.000000i)    

V=
       (11.000000,2.000000i)
       (12.000000,0.000000i)
       (13.000000,2.000000i)
       (14.000000,1.800000i)

Result vector=
       (35.000000,27.200000i)
       (159.000000,26.700000i)
       (325.400000,32.800000i)
       (288.000000,13.800000i)


Parameters:
	uplo specify whether the upper (uplo=UpperTriangle) or lower (uplo=LowerTriangle) triangle is being reference.
Return: NULL
*/

void  zhbmv(
MatrixTriangle uplo, 
int n, //the order of Hermitian band matrix A
int k, //the subdiagonals (superdiagonals) of A
complex alpha, 
const complex a[], //the complex Hermitian band matrix A
int tda, //the last dimension of A
const complex x[], //vector x
int incx,  //the spacing which the elements of vector x occur
complex beta,
complex y[], //Input: vector y; Output: alpha*Ax+beta*y
int incy  // the spacing which the elements of vector y occur
);


/** f06pec
       Compute a matrix-vector product for real symmetric packed matrix
Example:
	This example computes the matrix-vector product for a real symmetric packed matrix
       1.000000    2.000000    3.000000    4.000000    
       2.000000    6.000000    7.000000    8.000000    
       2.000000    7.000000    9.000000    10.000000    
       4.000000    8.000000    10.000000    11.000000  

    and a real vector
       12.000000
       13.000000
       14.000000
       15.000000

void test_f06pec()         //test for function dspmv(f06pec)
{
    int nColRow=4;

    matrix<double> mat_input_pack={1,2,3,4,
                                     6,7,8,
                                       9,10,
                                         11};

    matrix<double> mat_input={{1,2,3,4},
                              {2,6,7,8},
                              {2,7,9,10},
                              {4,8,10,11}};

    vector<double> vec_input={12,13,14,15};

    vector<double> vec_output(nColRow);
    vec_output=0;

    dspmv(UpperTriangle,nColRow,1,mat_input_pack,vec_input,1,1,vec_output,1);

    printf("Compute a matrix-vector product for real symmetric packed matrix M*V:\n");

    printf("M=\n");                     //output mat_input
    for(int i=0;i<nColRow;i++)
    {
       printf("       ");
       for(int j=0;j<nColRow;j++)
          printf("%f    ",mat_input[i][j]);
       printf("\n");
    }

    printf("\n");                       //output vec_input
    printf("V=\n");
    for(i=0;i<nColRow;i++)
    {
      printf("       ");
      printf("%f\n",vec_input[i]);
    }

    printf("\n");                       //output vec_output
    printf("Result vector=\n");
    for(i=0;i<nColRow;i++)
    {
      printf("       ");
      printf("%f\n",vec_output[i]);
    }
}

   The output is as following:
Compute a matrix-vector product for real symmetric packed matrix M*V:
M=
       1.000000    2.000000    3.000000    4.000000    
       2.000000    6.000000    7.000000    8.000000    
       2.000000    7.000000    9.000000    10.000000    
       4.000000    8.000000    10.000000    11.000000    

V=
       12.000000
       13.000000
       14.000000
       15.000000

Result vector=
       140.000000
       320.000000
       403.000000
       457.000000

Parameters:
	uplo specify whether the upper (uplo=UpperTriangle) or lower (uplo=LowerTriangle) triangle is being reference.
Return: NULL
*/
void  dspmv(
MatrixTriangle uplo, 
int n, // the order of the real symmetric packed matrix A 
double alpha, 
const double ap[], //the real symmetric matrix A in packed storage 
const double x[], //vetor x
int incx,  // the spacing which the elements of vector x occur
double beta, 
double y[], //Input: vector y; Output: alpha*Ax+beta*y
int incy  // the spacing which the elements of vector y occur
);

/** f06sec
       Compute a matrix-vector product for complex Hermitian packed matrix
Example:
	This example computes the matrix-vector product for a complex Hermitian packed matrix
       (1.000000,0.000000i)     (2.000000,2.100000i)    (3.000000,1.000000i)    (4.000000,1.300000i)    
       (2.000000,-2.100000i)    (5.000000,0.000000i)    (6.000000,2.600000i)    (7.000000,4.100000i)    
       (3.000000,-1.000000i)    (6.000000,-2.600000i)   (9.000000,0.000000i)    (10.000000,2.000000i)    
       (4.000000,-1.300000i)    (7.000000,-4.100000i)   (10.000000,-2.000000i)  (11.000000,0.000000i)    

    and a complex vector
       (11.000000,2.000000i)
       (12.000000,0.000000i)
       (13.000000,2.000000i)
       (14.000000,1.800000i)


void test_f06sec()      //test for function zhpmv(f06sec)
{
   int nRowCol=4;

   matrix<complex> mat_input={{1,2+2.1i,3+1.0i,4+1.3i},
                             {2-2.1i,5,6+2.6i,7+4.1i},
                             {3-1.0i,6-2.6i,9,10+2i},
                             {4-1.3i,7-4.1i,10-2i,11}};
       
   matrix<complex> mat_input_pack={1,2+2.1i,3+1.0i,4+1.3i,
                                          5,6+2.6i,7+4.1i,
                                                       9,10+2i,
                                                         11};

   vector<complex> vec_input={11+2i,12,13+2i,14+1.8i};

   vector<complex> vec_output(nRowCol);
   vec_output=0;

   zhpmv(UpperTriangle,nRowCol,1,mat_input_pack,vec_input,1,1,vec_output,1);

   printf("Compute a matrix-vector product for complex packed Hermitian matrix M*V:\n");

   printf("M=\n");                     //output mat_input
   for(int i=0;i<nRowCol;i++)
   {
       printf("       ");
       for(int j=0;j<nRowCol;j++)
          printf("(%f,%fi)    ",mat_input[i][j].m_re,mat_input[i][j].m_im);
       printf("\n");
   }

   printf("\n");                       //output vec_input
   printf("V=\n");
   for(i=0;i<nRowCol;i++)
   {
      printf("       ");
      printf("(%f,%fi)\n",vec_input[i].m_re,vec_input[i].m_im);
   }

   printf("\n");                       //output vec_output
   printf("Result vector=\n");
   for(i=0;i<nRowCol;i++)
   {
      printf("       ");
      printf("(%f,%fi)\n",vec_output[i].m_re,vec_output[i].m_im);
   }
}

   The output is as following:
Compute a matrix-vector product for complex packed Hermitian matrix M*V:
M=
       (1.000000,0.000000i)    (2.000000,2.100000i)    (3.000000,1.000000i)    (4.000000,1.300000i)    
       (2.000000,-2.100000i)    (5.000000,0.000000i)    (6.000000,2.600000i)    (7.000000,4.100000i)    
       (3.000000,-1.000000i)    (6.000000,-2.600000i)    (9.000000,0.000000i)    (10.000000,2.000000i)    
       (4.000000,-1.300000i)    (7.000000,-4.100000i)    (10.000000,-2.000000i)    (11.000000,0.000000i)    

V=
       (11.000000,2.000000i)
       (12.000000,0.000000i)
       (13.000000,2.000000i)
       (14.000000,1.800000i)

Result vector=
       (125.660000,71.600000i)
       (249.620000,96.700000i)
       (360.400000,27.800000i)
       (418.600000,-41.700000i)


Parameters:
	uplo specify whether the upper (uplo=UpperTriangle) or lower (uplo=LowerTriangle) triangle is being reference.
Return: NULL
*/
void  zhpmv(
MatrixTriangle uplo, 
int n, //the order of the complex Hermitian matrix A
complex alpha, 
const complex ap[], // order n complex Hermitian matrix A in packed storage
const complex x[], //vector x
int incx, //the spacing which the elements of vector x occur
complex beta, 
complex y[], //Input: vector y; Output: alpha*Ax+beta*y
int incy //the spacing which the elements of vector y occur
);


/** f06pfc
       Compute a matrix-vector product for real triangular matrix
Example:
	This example computes the matrix-vector product for a real triangular matrix
       1.000000    2.000000    3.000000    4.000000    
       0.000000    6.000000    7.000000    8.000000    
       0.000000    0.000000    9.000000    10.000000    
       0.000000    0.000000    0.000000    11.000000      

    and a real vector
       12.000000
       13.000000
       14.000000
       15.000000

void test_f06pfc()         //test for function dtrmv(f06pfc)
{
    int nColRow=4;

    matrix<double> mat_input={{1,2,3,4},
                              {0,6,7,8},
                              {0,0,9,10},
                              {0,0,0,11}};

    vector<double> vec_input={12,13,14,15};

    vector<double> vec_output;
    vec_output=vec_input;
    
    dtrmv(UpperTriangle,NoTranspose,NotUnitTriangular,nColRow,
            mat_input,nColRow,vec_output,1);

    printf("Compute a matrix-vector product for real triangular matrix M*V:\n");

    printf("M=\n");                     //output mat_input
    for(int i=0;i<nColRow;i++)
    {
       printf("       ");
       for(int j=0;j<nColRow;j++)
          printf("%f    ",mat_input[i][j]);
       printf("\n");
    }

    printf("\n");                       //output vec_input
    printf("V=\n");
    for(i=0;i<nColRow;i++)
    {
      printf("       ");
      printf("%f\n",vec_input[i]);
    }

    printf("\n");                       //output vec_output
    printf("Result vector=\n");
    for(i=0;i<nColRow;i++)
    {
      printf("       ");
      printf("%f\n",vec_output[i]);
    }
}

   The output is as following:
Compute a matrix-vector product for real triangular matrix M*V:
M=
       1.000000    2.000000    3.000000    4.000000    
       0.000000    6.000000    7.000000    8.000000    
       0.000000    0.000000    9.000000    10.000000    
       0.000000    0.000000    0.000000    11.000000    

V=
       12.000000
       13.000000
       14.000000
       15.000000

Result vector=
       140.000000
       296.000000
       276.000000
       165.000000

Parameters:
	trans=NoTranspose, return A*x in array x[];
	trans=Transpose, return transpose(A)*x in array x[];
	trans=ConjugateTranspose, return ConjugateTranspose(A)*x in array x[].
	uplo specify whether the upper (uplo=UpperTriangle) or lower (uplo=LowerTriangle) triangle is being reference.	
    diag specify whether or not the matrix is unit triangular. if diag=UnitTriangular, the diagonal elements are not referenced.
Return: NULL
*/
void  dtrmv(
MatrixTriangle uplo, 
MatrixTranspose trans, 
MatrixUnitTriangular diag, 
int n,  //the order of the real triangular matrix A
const double a[], // order n real triangular matrix A
int tda, // the last dimension of A
double x[], //Input: the vector x; Output: the product of A and x
int incx  // the spacing which the elements of x occur
);

/** f06sfc
       Compute a matrix-vector product for complex triangular matrix
Example:
	This example computes the matrix-vector product for a complex triangular matrix
       (1.000000,1.200000i)    (2.000000,2.100000i)    (4.000000,0.500000i)    (1.000000,0.000000i)    
       (0.000000,0.000000i)    (5.000000,1.200000i)    (6.000000,2.600000i)    (2.000000,1.000000i)    
       (0.000000,0.000000i)    (0.000000,0.000000i)    (9.000000,0.000000i)    (10.000000,2.000000i)    
       (0.000000,0.000000i)    (0.000000,0.000000i)    (0.000000,0.000000i)    (11.000000,4.000000i)    

    and a complex vector
       (11.000000,2.000000i)
       (12.000000,0.000000i)
       (13.000000,2.000000i)
       (14.000000,1.800000i)


void test_f06sfc()      //test for function ztrmv(f06sfc)
{
   int nRowCol=4;

   matrix<complex> mat_input={{1+1.2i,2+2.1i,4+0.5i,1},
                              {0,5+1.2i,6+2.6i,2+1i},
                               {0,0,9,10+2i},
                               {0,0,0,11+4i}};

   int k_nzero=1;

   vector<complex> vec_input={11+2i,12,13+2i,14+1.8i};

   vector<complex> vec_output(nRowCol);
   vec_output=vec_input;

   ztrmv(UpperTriangle,NoTranspose,NotUnitTriangular,nRowCol,
            mat_input,nRowCol,vec_output,1);

   printf("Compute a matrix-vector product for complex Hermitian band matrix M*V:\n");

   printf("M=\n");                     //output mat_input
   for(int i=0;i<nRowCol;i++)
   {
       printf("       ");
       for(int j=0;j<nRowCol;j++)
          printf("(%f,%fi)    ",mat_input[i][j].m_re,mat_input[i][j].m_im);
       printf("\n");
   }

   printf("\n");                       //output vec_input
   printf("V=\n");
   for(i=0;i<nRowCol;i++)
   {
      printf("       ");
      printf("(%f,%fi)\n",vec_input[i].m_re,vec_input[i].m_im);
   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -