diff options
Diffstat (limited to 'packages/base/src/C')
-rw-r--r-- | packages/base/src/C/lapack-aux.h | 2 | ||||
-rw-r--r-- | packages/base/src/C/vector-aux.c | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/packages/base/src/C/lapack-aux.h b/packages/base/src/C/lapack-aux.h index a3f1899..c95a2a3 100644 --- a/packages/base/src/C/lapack-aux.h +++ b/packages/base/src/C/lapack-aux.h | |||
@@ -36,6 +36,7 @@ typedef short ftnlen; | |||
36 | 36 | ||
37 | /********************************************************/ | 37 | /********************************************************/ |
38 | 38 | ||
39 | #define IVEC(A) int A##n, int*A##p | ||
39 | #define FVEC(A) int A##n, float*A##p | 40 | #define FVEC(A) int A##n, float*A##p |
40 | #define DVEC(A) int A##n, double*A##p | 41 | #define DVEC(A) int A##n, double*A##p |
41 | #define QVEC(A) int A##n, complex*A##p | 42 | #define QVEC(A) int A##n, complex*A##p |
@@ -47,6 +48,7 @@ typedef short ftnlen; | |||
47 | #define CMAT(A) int A##r, int A##c, doublecomplex* A##p | 48 | #define CMAT(A) int A##r, int A##c, doublecomplex* A##p |
48 | #define PMAT(A) int A##r, int A##c, void* A##p, int A##s | 49 | #define PMAT(A) int A##r, int A##c, void* A##p, int A##s |
49 | 50 | ||
51 | #define KIVEC(A) int A##n, const int*A##p | ||
50 | #define KFVEC(A) int A##n, const float*A##p | 52 | #define KFVEC(A) int A##n, const float*A##p |
51 | #define KDVEC(A) int A##n, const double*A##p | 53 | #define KDVEC(A) int A##n, const double*A##p |
52 | #define KQVEC(A) int A##n, const complex*A##p | 54 | #define KQVEC(A) int A##n, const complex*A##p |
diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c index 5b9c171..53b56aa 100644 --- a/packages/base/src/C/vector-aux.c +++ b/packages/base/src/C/vector-aux.c | |||
@@ -744,3 +744,29 @@ int random_vector(int seed, int code, DVEC(r)) { | |||
744 | } | 744 | } |
745 | } | 745 | } |
746 | 746 | ||
747 | //////////////////////////////////////////////////////////////////////////////// | ||
748 | |||
749 | int smXv(KDVEC(vals),KIVEC(cols),KIVEC(rows),KDVEC(x),DVEC(r)) { | ||
750 | int r, c; | ||
751 | for (r = 0; r < rowsn - 1; r++) { | ||
752 | rp[r] = 0; | ||
753 | for (c = rowsp[r]; c < rowsp[r+1]; c++) { | ||
754 | rp[r] += valsp[c-1] * xp[colsp[c-1]-1]; | ||
755 | } | ||
756 | } | ||
757 | OK | ||
758 | } | ||
759 | |||
760 | int smTXv(KDVEC(vals),KIVEC(cols),KIVEC(rows),KDVEC(x),DVEC(r)) { | ||
761 | int r,c; | ||
762 | for (c = 0; c < rn; c++) { | ||
763 | rp[c] = 0; | ||
764 | } | ||
765 | for (r = 0; r < rowsn - 1; r++) { | ||
766 | for (c = rowsp[r]; c < rowsp[r+1]; c++) { | ||
767 | rp[colsp[c-1]-1] += valsp[c-1] * xp[r]; | ||
768 | } | ||
769 | } | ||
770 | OK | ||
771 | } | ||
772 | |||