Changeset 2706f1e in tol
- Timestamp:
- Aug 26, 2009, 9:52:06 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- fe617e57
- Parents:
- 0fcdd1d
- File:
-
- 1 edited
-
tol/btol/vmatrix_type/vmat_convert.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/vmatrix_type/vmat_convert.cpp
r0fcdd1d r2706f1e 133 133 134 134 //////////////////////////////////////////////////////////////////////////////// 135 int BVMat::convertIfNeeded2cRs(const BVMat& A, const BVMat& B,136 BVMat*& A_, BVMat*& B_,137 const char* fName, bool forze)138 //Matrix instances139 ////////////////////////////////////////////////////////////////////////////////140 {141 if(!autoConvert_) { return(-1); }142 A_ = (BVMat*)&A;143 B_ = (BVMat*)&B;144 if(forze || !((A.code_==ESC_blasRdense)&&(B.code_==ESC_blasRdense)))145 {146 if(A.code_!=ESC_chlmRsparse)147 {148 warn_convert2cRs(fName,A);149 A_ = new BVMat(A,ESC_chlmRsparse);150 }151 if(B.code_!=ESC_chlmRsparse)152 {153 warn_convert2cRs(fName,B);154 B_ = new BVMat(B,ESC_chlmRsparse);155 }156 }157 return(0);158 }159 160 ////////////////////////////////////////////////////////////////////////////////161 135 int BVMat::convertIfNeeded_cRt2cRs(const BVMat& A, const BVMat& B, 162 136 BVMat*& A_, BVMat*& B_, … … 168 142 A_ = (BVMat*)&A; 169 143 B_ = (BVMat*)&B; 170 if(A.code_==ESC_chlmRtriplet) 144 int result = 0; 145 if((A.code_==ESC_chlmRsparse) && (B.code_==ESC_chlmRtriplet)) 146 { 147 warn_convert2cRs(fName,B); 148 B_ = new BVMat(B,ESC_chlmRsparse); 149 result = 1; 150 } 151 else if((B.code_==ESC_chlmRsparse) && (A.code_==ESC_chlmRtriplet)) 171 152 { 172 153 warn_convert2cRs(fName,A); 173 154 A_ = new BVMat(A,ESC_chlmRsparse); 174 } 175 if(B.code_==ESC_chlmRtriplet) 155 result = 1; 156 } 157 else 158 { 159 if(forze && (A.code_!=ESC_chlmRsparse)) 160 { 161 A_=new BVMat(A,ESC_chlmRsparse); 162 result = 1; 163 } 164 if(forze && (B.code_!=ESC_chlmRsparse)) 165 { 166 B_=new BVMat(B,ESC_chlmRsparse); 167 result = 1; 168 } 169 } 170 return(result); 171 } 172 173 //////////////////////////////////////////////////////////////////////////////// 174 int BVMat::convertIfNeeded_cRt2cRs(const BVMat& A, BVMat*& A_, 175 const char* fName) 176 //Matrix instances 177 //////////////////////////////////////////////////////////////////////////////// 178 { 179 if(!autoConvert_) { return(-1); } 180 A_ = (BVMat*)&A; 181 if(A.code_==ESC_chlmRtriplet) 176 182 { 177 warn_convert2cRs(fName, B);178 B_ = new BVMat(B,ESC_chlmRsparse);183 warn_convert2cRs(fName,A); 184 A_ = new BVMat(A, ESC_chlmRsparse); 179 185 } 180 186 return(0); … … 182 188 183 189 //////////////////////////////////////////////////////////////////////////////// 184 int BVMat::convertIfNeeded 2bRd(const BVMat& A, const BVMat& B,185 BVMat*& A_, BVMat*& B_,186 const char* fName, bool forze)190 int BVMat::convertIfNeeded_all2cRs(const BVMat& A, const BVMat& B, 191 BVMat*& A_, BVMat*& B_, 192 const char* fName, bool forze) 187 193 //Matrix instances 188 194 //////////////////////////////////////////////////////////////////////////////// … … 191 197 A_ = (BVMat*)&A; 192 198 B_ = (BVMat*)&B; 199 int result = 0; 200 if((A.code_==ESC_chlmRsparse) && (B.code_!=ESC_chlmRsparse)) 201 { 202 warn_convert2cRs(fName,B); 203 B_ = new BVMat(B, ESC_chlmRsparse); 204 result = 1; 205 } 206 else if((B.code_==ESC_chlmRsparse) && (A.code_!=ESC_chlmRsparse)) 207 { 208 warn_convert2cRs(fName,B); 209 A_ = new BVMat(A, ESC_chlmRsparse); 210 result = 1; 211 } 212 else 213 { 214 if(forze && (A.code_!=ESC_chlmRsparse)) 215 { 216 A_=new BVMat(A,ESC_chlmRsparse); 217 result = 1; 218 } 219 if(forze && (B.code_!=ESC_chlmRsparse)) 220 { 221 B_=new BVMat(B,ESC_chlmRsparse); 222 result = 1; 223 } 224 } 225 return(result); 226 } 227 228 //////////////////////////////////////////////////////////////////////////////// 229 int BVMat::convertIfNeeded_all2cRs(const BVMat& A, BVMat*& A_, 230 const char* fName) 231 //Matrix instances 232 //////////////////////////////////////////////////////////////////////////////// 233 { 234 if(!autoConvert_) { return(-1); } 235 A_ = (BVMat*)&A; 236 if(A.code_!=ESC_chlmRsparse) 237 { 238 warn_convert2cRs(fName,A); 239 A_ = new BVMat(A, ESC_chlmRsparse); 240 } 241 return(0); 242 } 243 244 245 //////////////////////////////////////////////////////////////////////////////// 246 int BVMat::convertIfNeeded_all2bRd(const BVMat& A, const BVMat& B, 247 BVMat*& A_, BVMat*& B_, 248 const char* fName, bool forze) 249 //Matrix instances 250 //////////////////////////////////////////////////////////////////////////////// 251 { 252 if(!autoConvert_) { return(-1); } 253 A_ = (BVMat*)&A; 254 B_ = (BVMat*)&B; 255 int result = 0; 193 256 if((A.code_==ESC_blasRdense) && (B.code_!=ESC_blasRdense)) 194 257 { 195 258 warn_convert2bRd(fName,B); 196 259 B_ = new BVMat(B, ESC_blasRdense); 260 result = 1; 197 261 } 198 262 else if((B.code_==ESC_blasRdense) && (A.code_!=ESC_blasRdense)) … … 200 264 warn_convert2bRd(fName,A); 201 265 A_ = new BVMat(A, ESC_blasRdense); 266 result = 1; 202 267 } 203 268 else 204 269 { 205 if(forze||(A.code_==ESC_chlmRtriplet)) { A_=new BVMat(A,ESC_chlmRsparse); } 206 if(forze||(B.code_==ESC_chlmRtriplet)) { B_=new BVMat(B,ESC_chlmRsparse); } 207 } 208 return(0); 209 } 210 211 //////////////////////////////////////////////////////////////////////////////// 212 int BVMat::convertIfNeeded2bRd(const BVMat& A, BVMat*& A_, 213 const char* fName) 270 if(forze && (A.code_!=ESC_blasRdense)) 271 { 272 A_=new BVMat(A,ESC_blasRdense); 273 result = 1; 274 } 275 if(forze && (B.code_!=ESC_blasRdense)) 276 { 277 B_=new BVMat(B,ESC_blasRdense); 278 result = 1; 279 } 280 } 281 return(result); 282 } 283 284 //////////////////////////////////////////////////////////////////////////////// 285 int BVMat::convertIfNeeded_all2bRd(const BVMat& A, BVMat*& A_, 286 const char* fName) 214 287 //Matrix instances 215 288 //////////////////////////////////////////////////////////////////////////////// … … 935 1008 } 936 1009 BVMat* A__, *B__; 937 convertIfNeeded2cRs(A_,B_,A__,B__,"|"); 1010 if((A_.code_!=ESC_blasRdense)||(B_.code_!=ESC_blasRdense)) 1011 { 1012 convertIfNeeded_all2cRs(A_,B_,A__,B__,"|",true); 1013 } 1014 else 1015 { 1016 A__=(BVMat*)&A_; 1017 B__=(BVMat*)&B_; 1018 } 938 1019 BVMat &A = *A__, &B = *B__; 939 1020 int cC = cA+cB; … … 989 1070 } 990 1071 BVMat* A__, *B__; 991 convertIfNeeded2cRs(A_,B_,A__,B__,"<<"); 1072 if((A_.code_!=ESC_blasRdense)||(B_.code_!=ESC_blasRdense)) 1073 { 1074 convertIfNeeded_all2cRs(A_,B_,A__,B__,"<<",true); 1075 } 1076 else 1077 { 1078 A__=(BVMat*)&A_; 1079 B__=(BVMat*)&B_; 1080 } 992 1081 BVMat &A = *A__, &B = *B__; 993 1082 int j;
Note: See TracChangeset
for help on using the changeset viewer.
