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

📄 lsymgcay.cc

📁 ARPACK is a collection of Fortran77 subroutines designed to solve large scale eigenvalue problems.
💻 CC
字号:
/*   ARPACK++ v1.0 8/1/1997   c++ interface to ARPACK code.   MODULE LSymGCay.cc.   Example program that illustrates how to solve a real symmetric   generalized eigenvalue problem in Cayley mode using the   ARluSymGenEig class.   1) Problem description:      In this example we try to solve A*x = B*x*lambda in Cayley      mode, where A and B are obtained from the finite element       discretization of the 1-dimensional discrete Laplacian                                  d^2u / dx^2      on the interval [0,1] with zero Dirichlet boundary conditions      using piecewise linear elements.   2) Data structure used to represent matrices A and B:      {nnzA, irowA, pcolA, valA}: lower triangular part of matrix A                                   stored in CSC format.      {nnzB, irowB, pcolB, valB}: lower triangular part of matrix B                                   stored in CSC format.   3) Library called by this example:      The SuperLU package is called by ARluSymGenEig to solve      some linear systems involving (A-sigma*B).   4) Included header files:      File             Contents      -----------      -------------------------------------------      lsmatrxc.h       SymmetricMatrixC, a function that generates                       matrix A in CSC format.      lsmatrxd.h       SymmetricMatrixD, a function that generates                       matrix B in CSC format.      arlsmat.h        The ARluSymMatrix class definition.      arlgsym.h        The ARluSymGenEig class definition.      lsymsol.h        The Solution function.   5) ARPACK Authors:      Richard Lehoucq      Kristyn Maschhoff      Danny Sorensen      Chao Yang      Dept. of Computational & Applied Mathematics      Rice University      Houston, Texas*/#include "lsmatrxc.h"#include "lsmatrxd.h"#include "arlsmat.h"#include "arlgsym.h"#include "lsymsol.h"main(){  int    n;              // Dimension of the problem.  int    nnzA,   nnzB;   // Number of nonzero elements in A and B.  int    *irowA, *irowB; // pointer to an array that stores the row                         // indices of the nonzeros in A and B.  int    *pcolA, *pcolB; // pointer to an array of pointers to the                         // beginning of each column of A (B) in valA (valB).  double *valA,  *valB;  // pointer to an array that stores the nonzero                         // elements of A and B.  // Creating matrices A and B.  n = 100;  SymmetricMatrixC(n, nnzA, valA, irowA, pcolA);  ARluSymMatrix<double> A(n, nnzA, valA, irowA, pcolA);  SymmetricMatrixD(n, nnzB, valB, irowB, pcolB);  ARluSymMatrix<double> B(n, nnzB, valB, irowB, pcolB);  // Defining what we need: the four eigenvectors nearest to 150.0.  ARluSymGenEig<double> dprob('C', 4L, A, B, 150.0);  // Finding eigenvalues and eigenvectors.  dprob.FindEigenvectors();  // Printing solution.  Solution(A, B, dprob);} // main.

⌨️ 快捷键说明

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