| 733 | /******************************************************************************/ |
| 734 | |
| 735 | void dscal ( int n, double sa, double x[], int incx ) |
| 736 | |
| 737 | /******************************************************************************/ |
| 738 | /* |
| 739 | Purpose: |
| 740 | |
| 741 | DSCAL scales a vector by a constant. |
| 742 | |
| 743 | Modified: |
| 744 | |
| 745 | 30 March 2007 |
| 746 | |
| 747 | Author: |
| 748 | |
| 749 | FORTRAN77 original by Jack Dongarra, Cleve Moler, Jim Bunch, Pete Stewart. |
| 750 | C version by John Burkardt |
| 751 | |
| 752 | Reference: |
| 753 | |
| 754 | Jack Dongarra, Cleve Moler, Jim Bunch, Pete Stewart, |
| 755 | LINPACK User's Guide, |
| 756 | SIAM, 1979. |
| 757 | |
| 758 | Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh, |
| 759 | Basic Linear Algebra Subprograms for Fortran Usage, |
| 760 | Algorithm 539, |
| 761 | ACM Transactions on Mathematical Software, |
| 762 | Volume 5, Number 3, September 1979, pages 308-323. |
| 763 | |
| 764 | Parameters: |
| 765 | |
| 766 | Input, int N, the number of entries in the vector. |
| 767 | |
| 768 | Input, double SA, the multiplier. |
| 769 | |
| 770 | Input/output, double X[*], the vector to be scaled. |
| 771 | |
| 772 | Input, int INCX, the increment between successive entries of X. |
| 773 | */ |
| 774 | { |
| 775 | int i; |
| 776 | int ix; |
| 777 | int m; |
| 778 | |
| 779 | if ( n <= 0 ) |
| 780 | { |
| 781 | } |
| 782 | else if ( incx == 1 ) |
| 783 | { |
| 784 | m = n % 5; |
| 785 | |
| 786 | for ( i = 0; i < m; i++ ) |
| 787 | { |
| 788 | x[i] = sa * x[i]; |
| 789 | } |
| 790 | |
| 791 | for ( i = m; i < n; i = i + 5 ) |
| 792 | { |