c2-7 (779465), страница 6

Файл №779465 c2-7 (Numerical Recipes in C) 6 страницаc2-7 (779465) страница 62017-12-27СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 6)

Used by linbcg.{unsigned long i,isamax;double ans;if (itol <= 3) {ans = 0.0;for (i=1;i<=n;i++) ans += sx[i]*sx[i];Vector magnitude norm.return sqrt(ans);} else {isamax=1;for (i=1;i<=n;i++) {Largest component norm.if (fabs(sx[i]) > fabs(sx[isamax])) isamax=i;}return fabs(sx[isamax]);}}So that the specifications for the routines atimes and asolve are clear, we list heresimple versions that assume a matrix A stored somewhere in row-index sparse format.extern unsigned long ija[];extern double sa[];The matrix is stored somewhere.void atimes(unsigned long n, double x[], double r[], int itrnsp){void dsprsax(double sa[], unsigned long ija[], double x[], double b[],unsigned long n);Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).else if (itol == 3 || itol == 4) {zm1nrm=znrm;znrm=snrm(n,z,itol);if (fabs(zm1nrm-znrm) > EPS*znrm) {dxnrm=fabs(ak)*snrm(n,p,itol);*err=znrm/fabs(zm1nrm-znrm)*dxnrm;} else {*err=znrm/bnrm;Error may not be accurate, so loop again.continue;}xnrm=snrm(n,x,itol);if (*err <= 0.5*xnrm) *err /= xnrm;else {*err=znrm/bnrm;Error may not be accurate, so loop again.continue;}}printf("iter=%4d err=%12.6f\n",*iter,*err);if (*err <= tol) break;}2.7 Sparse Linear Systems89void dsprstx(double sa[], unsigned long ija[], double x[], double b[],unsigned long n);These are double versions of sprsax and sprstx.if (itrnsp) dsprstx(sa,ija,x,r,n);else dsprsax(sa,ija,x,r,n);}The matrix is stored somewhere.void asolve(unsigned long n, double b[], double x[], int itrnsp){unsigned long i;for(i=1;i<=n;i++) x[i]=(sa[i] != 0.0 ? b[i]/sa[i] : b[i]);e is the diagonal part of A, stored in the first n elements of sa.

Since theThe matrix Atranspose matrix has the same diagonal, the flag itrnsp is not used.}CITED REFERENCES AND FURTHER READING:Tewarson, R.P. 1973, Sparse Matrices (New York: Academic Press). [1]Jacobs, D.A.H. (ed.) 1977, The State of the Art in Numerical Analysis (London: AcademicPress), Chapter I.3 (by J.K.

Reid). [2]George, A., and Liu, J.W.H. 1981, Computer Solution of Large Sparse Positive Definite Systems(Englewood Cliffs, NJ: Prentice-Hall). [3]NAG Fortran Library (Numerical Algorithms Group, 256 Banbury Road, Oxford OX27DE, U.K.).[4]IMSL Math/Library Users Manual (IMSL Inc., 2500 CityWest Boulevard, Houston TX 77042). [5]Eisenstat, S.C., Gursky, M.C., Schultz, M.H., and Sherman, A.H.

1977, Yale Sparse Matrix Package, Technical Reports 112 and 114 (Yale University Department of Computer Science). [6]Knuth, D.E. 1968, Fundamental Algorithms, vol. 1 of The Art of Computer Programming (Reading,MA: Addison-Wesley), §2.2.6.

[7]Kincaid, D.R., Respess, J.R., Young, D.M., and Grimes, R.G. 1982, ACM Transactions on Mathematical Software, vol. 8, pp. 302–322. [8]PCGPAK User’s Guide (New Haven: Scientific Computing Associates, Inc.). [9]Bentley, J. 1986, Programming Pearls (Reading, MA: Addison-Wesley), §9. [10]Golub, G.H., and Van Loan, C.F. 1989, Matrix Computations, 2nd ed. (Baltimore: Johns HopkinsUniversity Press), Chapters 4 and 10, particularly §§10.2–10.3. [11]Stoer, J., and Bulirsch, R. 1980, Introduction to Numerical Analysis (New York: Springer-Verlag),Chapter 8.

[12]Baker, L. 1991, More C Tools for Scientists and Engineers (New York: McGraw-Hill). [13]Fletcher, R. 1976, in Numerical Analysis Dundee 1975, Lecture Notes in Mathematics, vol. 506,A. Dold and B Eckmann, eds. (Berlin: Springer-Verlag), pp. 73–89. [14]Saad, Y., and Schulz, M. 1986, SIAM Journal on Scientific and Statistical Computing, vol. 7,pp.

856–869. [15]Bunch, J.R., and Rose, D.J. (eds.) 1976, Sparse Matrix Computations (New York: AcademicPress).Duff, I.S., and Stewart, G.W. (eds.) 1979, Sparse Matrix Proceedings 1978 (Philadelphia:S.I.A.M.).Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).extern unsigned long ija[];extern double sa[];90Chapter 2.Solution of Linear Algebraic Equations2.8 Vandermonde Matrices and ToeplitzMatricesVandermonde MatricesA Vandermonde matrix of size N × N is completely determined by N arbitrarynumbers x1 , x2 , .

. . , xN , in terms of which its N 2 components are the integer powersxj−1, i, j = 1, . . . , N . Evidently there are two possible such forms, depending on whetheriwe view the i’s as rows, j’s as columns, or vice versa. In the former case, we get a linearsystem of equations that looks like this,11. ..1x1x21···x2...xNx22...x2N······−1xN1  −1  xN2·.. .  −1xNNc1c2...cN  =  y1y2 .. .

yN(2.8.1)Performing the matrix multiplication, you will see that this equation solves for the unknowncoefficients ci which fit a polynomial to the N pairs of abscissas and ordinates (xj , yj ).Precisely this problem will arise in §3.5, and the routine given there will solve (2.8.1) by themethod that we are about to describe.Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited.

To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).In §2.4 the case of a tridiagonal matrix was treated specially, because thatparticular type of linear system admits a solution in only of order N operations,rather than of order N 3 for the general linear problem. When such particular typesexist, it is important to know about them.

Your computational savings, should youever happen to be working on a problem that involves the right kind of particulartype, can be enormous.This section treats two special types of matrices that can be solved in of orderN 2 operations, not as good as tridiagonal, but a lot better than the general case.(Other than the operations count, these two types having nothing in common.)Matrices of the first type, termed Vandermonde matrices, occur in some problemshaving to do with the fitting of polynomials, the reconstruction of distributions fromtheir moments, and also other contexts.

In this book, for example, a Vandermondeproblem crops up in §3.5. Matrices of the second type, termed Toeplitz matrices,tend to occur in problems involving deconvolution and signal processing. In thisbook, a Toeplitz problem is encountered in §13.7.These are not the only special types of matrices worth knowing about.

TheHilbert matrices, whose components are of the form aij = 1/(i + j − 1), i, j =1, . . . , N can be inverted by an exact integer algorithm, and are very difficult toinvert in any other way, since they are notoriously ill-conditioned (see [1] for details).The Sherman-Morrison and Woodbury formulas, discussed in §2.7, can sometimesbe used to convert new special forms into old ones. Reference [2] gives some otherspecial forms. We have not found these additional forms to arise as frequently asthe two that we now discuss..

Характеристики

Тип файла
PDF-файл
Размер
283,79 Kb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6439
Авторов
на СтудИзбе
306
Средний доход
с одного платного файла
Обучение Подробнее