Debian Codegraph @

3rdparty/ipopt/patch-IpBlas

raw
1 --- Ipopt-3.10.2/Ipopt/src/LinAlg/IpBlas.cpp 2010-12-21 22:34:47.000000000 +0100
2 +++ Ipopt-3.10.2-okk/Ipopt/src/LinAlg/IpBlas.cpp 2012-03-15 15:30:11.000000000 +0100
3 @@ -8,7 +8,7 @@
4
5 #include "IpoptConfig.h"
6 #include "IpBlas.hpp"
7 -
8 +#include <cassert>
9 // Prototypes for the BLAS routines
10 extern "C"
11 {
12 @@ -57,6 +57,7 @@
13 int transa_len, int diag_len);
14 }
15
16 +
17 namespace Ipopt
18 {
19 #ifndef HAVE_CBLAS
20 @@ -65,8 +66,13 @@
21 Index incY)
22 {
23 ipfint n=size, INCX=incX, INCY=incY;
24 -
25 - return F77_FUNC(ddot,DDOT)(&n, x, &INCX, y, &INCY);
26 +
27 + Number s=0;
28 + if( incX && incY ) s= F77_FUNC(ddot,DDOT)(&n, x, &INCX, y, &INCY) ;
29 + else
30 + for (int i=0,ix=0,iy=0; i<n; ++i, ix += incX, iy += incY )
31 + s += x[ix]*y[iy];
32 + return s ;
33 }
34
35 /* Interface to FORTRAN routine DNRM2. */
36 @@ -81,7 +87,7 @@
37 Number IpBlasDasum(Index size, const Number *x, Index incX)
38 {
39 ipfint n=size, INCX=incX;
40 -
41 + assert(incX); // FH
42 return F77_FUNC(dasum,DASUM)(&n, x, &INCX);
43 }
44
45 @@ -89,7 +95,7 @@
46 Index IpBlasIdamax(Index size, const Number *x, Index incX)
47 {
48 ipfint n=size, INCX=incX;
49 -
50 + assert(incX); // FH
51 return (Index) F77_FUNC(idamax,IDAMAX)(&n, x, &INCX);
52 }
53
54 @@ -97,8 +103,17 @@
55 void IpBlasDcopy(Index size, const Number *x, Index incX, Number *y, Index incY)
56 {
57 ipfint N=size, INCX=incX, INCY=incY;
58 -
59 - F77_FUNC(dcopy,DCOPY)(&N, x, &INCX, y, &INCY);
60 + if(incX)
61 + F77_FUNC(dcopy,DCOPY)(&N, x, &INCX, y, &INCY);
62 + else // modif FH
63 + if(incY==1)
64 + {
65 + Number *ey = y + size;
66 + while (y <ey) *y++=*x;
67 + }
68 + else
69 + for(Index i=0,ii=0; i<size;++i, ii+=incY)
70 + y[ii]=*x;
71 }
72
73 /* Interface to FORTRAN routine DAXPY. */
74 @@ -106,15 +121,25 @@
75 Index incY)
76 {
77 ipfint N=size, INCX=incX, INCY=incY;
78 -
79 - F77_FUNC(daxpy,DAXPY)(&N, &alpha, x, &INCX, y, &INCY);
80 + if(incX)
81 + F77_FUNC(daxpy,DAXPY)(&N, &alpha, x, &INCX, y, &INCY);
82 + else // modif FH
83 + if(incY==1)
84 + {
85 + Number *ey = y + size;
86 + while (y <ey)
87 + *y++ += *x * alpha;
88 + }
89 + else
90 + for(Index i=0,ii=0; i<size;++i, ii+=incY)
91 + y[ii] += *x * alpha;
92 }
93
94 /* Interface to FORTRAN routine DSCAL. */
95 void IpBlasDscal(Index size, Number alpha, Number *x, Index incX)
96 {
97 ipfint N=size, INCX=incX;
98 -
99 + assert(incX); // FH
100 F77_FUNC(dscal,DSCAL)(&N, &alpha, x, &INCX);
101 }
102
103 @@ -123,7 +148,7 @@
104 Index incX, Number beta, Number* y, Index incY)
105 {
106 ipfint M=nCols, N=nRows, LDA=ldA, INCX=incX, INCY=incY;
107 -
108 + assert(incX && incY); // FH
109 char TRANS;
110 if (trans) {
111 TRANS = 'T';
112 @@ -141,7 +166,7 @@
113 Index incY)
114 {
115 ipfint N=n, LDA=ldA, INCX=incX, INCY=incY;
116 -
117 + assert(incX && incY); // FH
118 char UPLO='L';
119
120 F77_FUNC(dsymv,DSYMV)(&UPLO, &N, &alpha, A, &LDA, x,
121 --- Ipopt-3.10.2/Ipopt/src/Algorithm/IpIpoptAlg.cpp 2011-06-11 11:23:59.000000000 -0500
122 +++ Ipopt-3.10.2-okk/Ipopt/src/Algorithm/IpIpoptAlg.cpp 2013-02-12 14:07:39.000000000 -0600
123 @@ -262,7 +262,7 @@
124 }
125
126 if (!isResto) {
127 - Jnlst().Printf(J_ITERSUMMARY, J_MAIN, "This is Ipopt version "IPOPT_VERSION", running with linear solver %s.\n\n", linear_solver_.c_str());
128 + Jnlst().Printf(J_ITERSUMMARY, J_MAIN, "This is Ipopt version " IPOPT_VERSION ", running with linear solver %s.\n\n", linear_solver_.c_str());
129 }
130
131 SolverReturn retval = UNASSIGNED;