Révision | 2e2bb6e1c5d6d899c15ec5ebd68312bdcb1acdd1 (tree) |
---|---|
l'heure | 2014-01-17 17:17:18 |
Auteur | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Add wrapper functions of BLAS dnrm2 routine. #30379
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1653 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -132,6 +132,25 @@ double Blas::Ddot(molds_blas_int n, | ||
132 | 132 | return cblas_ddot(n, x, incrementX, y, incrementY); |
133 | 133 | } |
134 | 134 | |
135 | +// returns sqrt(sum(Xi^2)) | |
136 | +// vectorX: n-vector | |
137 | +double Blas::Dnrm2(molds_blas_int n, | |
138 | + double const* vectorX) const{ | |
139 | + molds_blas_int incrementX = 1; | |
140 | + return this->Dnrm2(n,vectorX,incrementX); | |
141 | +} | |
142 | +// returns sqrt(sum(Xi^2)) | |
143 | +// vectorX: n-vector | |
144 | +double Blas::Dnrm2(molds_blas_int n, | |
145 | + double const* vectorX, | |
146 | + molds_blas_int incrementX) const{ | |
147 | + if(n<=0 || vectorX == NULL || incrementX <= 0){ | |
148 | + return 0.0; | |
149 | + } | |
150 | + double* x=const_cast<double*>(vectorX); | |
151 | + return cblas_dnrm2(n,x,incrementX); | |
152 | +} | |
153 | + | |
135 | 154 | // returns max(abs(vectorX[i])) |
136 | 155 | // vectorX: n-vector |
137 | 156 | double Blas::Damax(molds_blas_int n, |
@@ -45,6 +45,11 @@ public: | ||
45 | 45 | double Ddot(molds_blas_int n, |
46 | 46 | double const* vectorX, molds_blas_int incrementX, |
47 | 47 | double const* vectorY, molds_blas_int incrementY)const; |
48 | + double Dnrm2(molds_blas_int n, | |
49 | + double const* vectorX) const; | |
50 | + double Dnrm2(molds_blas_int n, | |
51 | + double const* vectorX, | |
52 | + molds_blas_int incrementX) const; | |
48 | 53 | double Damax(molds_blas_int n, |
49 | 54 | double const* vectorX) const; |
50 | 55 | double Damax(molds_blas_int n, |