60int main(
int argc,
char* argv[])
65 if (argc>1)
if (argv[1][0]==
'-' && argv[1][1]==
'v') verbose =
true;
70 int numberFailedTests = 0;
72 std::string testName =
"";
76 if (verbose) std::cout<<std::endl<<
"********** CHECKING TEUCHOS SERIAL DENSE MATRIX **********"<<std::endl<<std::endl;
80 if (verbose) std::cout <<
"default constructor -- construct empty matrix ";
81 if ( DefConTest.values()!=NULL || DefConTest.numCols()!=0 || DefConTest.numRows()!=0 ||DefConTest.stride()!=0 ||DefConTest.empty()!=
true ) {
82 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
85 if (verbose) std::cout <<
"successful."<<std::endl;
91 if (verbose) std::cout <<
"constructor 1 -- empty matrix with given dimensions ";
92 if ( Con1Test.numRows()!=3 || Con1Test.numCols()!=4 || Con1Test( 1, 2 )!=0.0 ) {
93 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
96 if (verbose) std::cout <<
"successful."<<std::endl;
102 for(i = 0; i < 9; i++)
107 Con2Test1ExpRes.shape(2, 3);
108 Con2Test1ExpRes(0, 0) = 0; Con2Test1ExpRes(0, 1) = 2; Con2Test1ExpRes(0, 2) = 4;
109 Con2Test1ExpRes(1, 0) = 1; Con2Test1ExpRes(1, 1) = 3; Con2Test1ExpRes(1, 2) = 5;
112 numberFailedTests +=
PrintTestResults(
"constructor 2 -- construct matrix from array subrange", Con2Test1, Con2Test1ExpRes, verbose);
117 DMatrix Con3TestCopy( Con2Test1ExpRes );
118 if(verbose) std::cout <<
"constructor 3 -- copy constructor ";
119 if ( Con3TestCopy != Con2Test1ExpRes ) {
120 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
123 if (verbose) std::cout <<
"successful."<<std::endl;
127 if(verbose) std::cout <<
"constructor 3 -- copy constructor (transposed) ";
128 if ( Con3TestCopyTrans(2, 0) != Con2Test1ExpRes(0, 2) ) {
129 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
132 if (verbose) std::cout <<
"successful."<<std::endl;
139 Con4TestSubmatrix.shape(2, 2);
140 Con4TestSubmatrix(0, 0) = 4; Con4TestSubmatrix(0, 1) = 7;
141 Con4TestSubmatrix(1, 0) = 5; Con4TestSubmatrix(1, 1) = 8;
143 numberFailedTests +=
PrintTestResults(
"constructor 4 -- submatrix copy", Con4TestCopy1, Con4TestSubmatrix, verbose);
145 numberFailedTests +=
PrintTestResults(
"constructor 4 -- full matrix copy", Con4TestCopy2, Con4TestOrig, verbose);
147 numberFailedTests +=
PrintTestResults(
"constructor 4 -- full matrix view", Con4TestView1, Con4TestSubmatrix, verbose);
149 numberFailedTests +=
PrintTestResults(
"constructor 4 -- submatrix view", Con4TestView2, Con4TestOrig, verbose);
155 AAA(0, 0) = 1; AAA(0, 1) = 2; AAA(0, 2) = 3;
156 AAA(1, 0) = 4; AAA(1, 1) = 5; AAA(1, 2) = 6;
157 AAA(2, 0) = 7; AAA(2, 1) = 8; AAA(2, 2) = 9;
159 numberFailedTests +=
PrintTestResults(
"normOne of a 3x3", AAA.normOne(), 18.0, verbose);
160 numberFailedTests +=
PrintTestResults(
"normInf of a 3x3", AAA.normInf(), 24.0, verbose);
162 numberFailedTests +=
PrintTestResults(
"normFrobenius of a 3x3", AAA.normFrobenius(), 3.0, verbose);
163 numberFailedTests +=
PrintTestResults(
"normOne of a 0x0", BBB.normOne(), 0.0, verbose);
164 numberFailedTests +=
PrintTestResults(
"normInf of a 0x0", BBB.normInf(), 0.0, verbose);
165 numberFailedTests +=
PrintTestResults(
"normFrobenius of a 0x0", BBB.normFrobenius(), 0.0, verbose);
169 DMatrix DimTest0x0A, DimTest0x0B, DimTest2x0, DimTest1x2, DimTest2x1, DimTest2x2A, DimTest2x2B,
170 DimTest3x3, DimTest0x2, DimTest0x0Result, DimTest1x1Result, DimTest2x0Result, DimTest1x2Result, DimTest2x1Result, DimTest2x2Result,
171 DimTest2x3Result, DimTest0x2Result, DimTest3x3Result;
173 DimTest0x2.shape(0, 2);
174 DimTest2x0.shape(2, 0);
175 DimTest1x2.shape(1, 2);
176 DimTest2x1.shape(2, 1);
177 DimTest2x2A.shape(2, 2);
178 DimTest2x2B.shape(2, 2);
179 DimTest3x3.shape(3, 3);
180 DimTest0x2Result.shape(0, 2);
181 DimTest1x1Result.shape(1, 1);
182 DimTest2x0Result.shape(2, 0);
183 DimTest1x2Result.shape(1, 2);
184 DimTest2x1Result.shape(2, 1);
185 DimTest2x2Result.shape(2, 2);
186 DimTest2x3Result.shape(2, 3);
187 DimTest3x3Result.shape(3, 3);
190 testName =
"multiply() -- dimensions -- compatible square matrices";
191 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 0, verbose);
193 testName =
"multiply() -- dimensions -- incompatible square matrices";
194 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
196 testName =
"multiply() -- dimensions -- compatible nonsquare matrices";
197 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 0, verbose);
199 testName =
"multiply() -- dimensions -- compatible nonsquare matrices";
200 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 0, verbose);
202 testName =
"multiply() -- dimensions -- incompatible nonsquare matrices";
203 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
205 testName =
"multiply() -- dimensions -- incompatible nonsquare matrices";
206 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
208 testName =
"multiply() -- dimensions -- first operand bad numCols";
209 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
211 testName =
"multiply() -- dimensions -- second operand bad numRows";
212 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
214 testName =
"multiply() -- dimensions -- second operand bad numCols";
215 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 1, verbose);
219 DMatrix MultTest2x2A, MultTest2x2B, MultTest3x3A, MultTest3x3B, MultTest2x2ATimes2x2B,
220 MultTest3x3ATimes3x3B, MultTest2x2BTimes2x2A, MultTest3x3BTimes3x3A, MultTest2x2ATimes2x2BExpResult, MultTest2x2BTimes2x2AExpResult,
221 MultTest3x3ATimes3x3BExpResult, MultTest3x3BTimes3x3AExpResult, MultTest2x3A, MultTest2x3B, MultTest3x2A, MultTest3x2B,
222 MultTest2x3ATimes3x2B, MultTest3x2ATimes2x3B, MultTest2x3BTimes3x2A, MultTest3x2BTimes2x3A, MultTest2x3ATimes3x2BExpResult,
223 MultTest3x2ATimes2x3BExpResult, MultTest2x3BTimes3x2AExpResult, MultTest3x2BTimes2x3AExpResult;
225 MultTest2x2A.shape(2, 2);
226 MultTest2x2B.shape(2, 2);
227 MultTest3x3A.shape(3, 3);
228 MultTest3x3B.shape(3, 3);
229 MultTest2x2ATimes2x2B.shape(2, 2);
230 MultTest2x2BTimes2x2A.shape(2, 2);
231 MultTest3x3ATimes3x3B.shape(3, 3);
232 MultTest3x3BTimes3x3A.shape(3, 3);
233 MultTest2x2ATimes2x2BExpResult.shape(2, 2);
234 MultTest2x2BTimes2x2AExpResult.shape(2, 2);
235 MultTest3x3ATimes3x3BExpResult.shape(3, 3);
236 MultTest3x3BTimes3x3AExpResult.shape(3, 3);
237 MultTest2x3A.shape(2, 3);
238 MultTest2x3B.shape(2, 3);
239 MultTest3x2A.shape(3, 2);
240 MultTest3x2B.shape(3, 2);
241 MultTest2x3ATimes3x2B.shape(2, 2);
242 MultTest3x2ATimes2x3B.shape(3, 3);
243 MultTest2x3BTimes3x2A.shape(2, 2);
244 MultTest3x2BTimes2x3A.shape(3, 3);
245 MultTest2x3ATimes3x2BExpResult.shape(2, 2);
246 MultTest3x2ATimes2x3BExpResult.shape(3, 3);
247 MultTest2x3BTimes3x2AExpResult.shape(2, 2);
248 MultTest3x2BTimes2x3AExpResult.shape(3, 3);
250 for(i = 0; i < 2; i++)
252 for(j = 0; j < 2; j++)
254 MultTest2x2A(i, j) = i + j;
255 MultTest2x2B(i, j) = (i * j) + 1;
258 for(i = 0; i < 3; i++)
260 for(j = 0; j < 3; j++)
262 MultTest3x3A(i, j) = i + j;
263 MultTest3x3B(i, j) = (i * j) + 1;
267 MultTest2x2ATimes2x2BExpResult(0, 0) = 1; MultTest2x2ATimes2x2BExpResult(0, 1) = 2;
268 MultTest2x2ATimes2x2BExpResult(1, 0) = 3; MultTest2x2ATimes2x2BExpResult(1, 1) = 5;
269 MultTest2x2BTimes2x2AExpResult(0, 0) = 1; MultTest2x2BTimes2x2AExpResult(0, 1) = 3;
270 MultTest2x2BTimes2x2AExpResult(1, 0) = 2; MultTest2x2BTimes2x2AExpResult(1, 1) = 5;
271 MultTest3x3ATimes3x3BExpResult(0, 0) = 3; MultTest3x3ATimes3x3BExpResult(0, 1) = 8; MultTest3x3ATimes3x3BExpResult(0, 2) = 13;
272 MultTest3x3ATimes3x3BExpResult(1, 0) = 6; MultTest3x3ATimes3x3BExpResult(1, 1) = 14; MultTest3x3ATimes3x3BExpResult(1, 2) = 22;
273 MultTest3x3ATimes3x3BExpResult(2, 0) = 9; MultTest3x3ATimes3x3BExpResult(2, 1) = 20; MultTest3x3ATimes3x3BExpResult(2, 2) = 31;
274 MultTest3x3BTimes3x3AExpResult(0, 0) = 3; MultTest3x3BTimes3x3AExpResult(0, 1) = 6; MultTest3x3BTimes3x3AExpResult(0, 2) = 9;
275 MultTest3x3BTimes3x3AExpResult(1, 0) = 8; MultTest3x3BTimes3x3AExpResult(1, 1) = 14; MultTest3x3BTimes3x3AExpResult(1, 2) = 20;
276 MultTest3x3BTimes3x3AExpResult(2, 0) = 13; MultTest3x3BTimes3x3AExpResult(2, 1) = 22; MultTest3x3BTimes3x3AExpResult(2, 2) = 31;
277 MultTest2x3A(0, 0) = 1; MultTest2x3A(0, 1) = 2; MultTest2x3A(0, 2) = 3;
278 MultTest2x3A(1, 0) = 4; MultTest2x3A(1, 1) = 5; MultTest2x3A(1, 2) = 6;
279 MultTest3x2A(0, 0) = 1; MultTest3x2A(0, 1) = 2;
280 MultTest3x2A(1, 0) = 3; MultTest3x2A(1, 1) = 4;
281 MultTest3x2A(2, 0) = 5; MultTest3x2A(2, 1) = 6;
282 MultTest2x3B(0, 0) = 0; MultTest2x3B(0, 1) = 2; MultTest2x3B(0, 2) = 4;
283 MultTest2x3B(1, 0) = 6; MultTest2x3B(1, 1) = 8; MultTest2x3B(1, 2) = 10;
284 MultTest3x2B(0, 0) = 0; MultTest3x2B(0, 1) = 2;
285 MultTest3x2B(1, 0) = 4; MultTest3x2B(1, 1) = 6;
286 MultTest3x2B(2, 0) = 8; MultTest3x2B(2, 1) = 10;
287 MultTest2x3ATimes3x2BExpResult(0, 0) = 32; MultTest2x3ATimes3x2BExpResult(0, 1) = 44;
288 MultTest2x3ATimes3x2BExpResult(1, 0) = 68; MultTest2x3ATimes3x2BExpResult(1, 1) = 98;
289 MultTest3x2ATimes2x3BExpResult(0, 0) = 12; MultTest3x2ATimes2x3BExpResult(0, 1) = 18; MultTest3x2ATimes2x3BExpResult(0, 2) = 24;
290 MultTest3x2ATimes2x3BExpResult(1, 0) = 24; MultTest3x2ATimes2x3BExpResult(1, 1) = 38; MultTest3x2ATimes2x3BExpResult(1, 2) = 52;
291 MultTest3x2ATimes2x3BExpResult(2, 0) = 36; MultTest3x2ATimes2x3BExpResult(2, 1) = 58; MultTest3x2ATimes2x3BExpResult(2, 2) = 80;
292 MultTest2x3BTimes3x2AExpResult(0, 0) = 26; MultTest2x3BTimes3x2AExpResult(0, 1) = 32;
293 MultTest2x3BTimes3x2AExpResult(1, 0) = 80; MultTest2x3BTimes3x2AExpResult(1, 1) = 104;
294 MultTest3x2BTimes2x3AExpResult(0, 0) = 8; MultTest3x2BTimes2x3AExpResult(0, 1) = 10; MultTest3x2BTimes2x3AExpResult(0, 2) = 12;
295 MultTest3x2BTimes2x3AExpResult(1, 0) = 28; MultTest3x2BTimes2x3AExpResult(1, 1) = 38; MultTest3x2BTimes2x3AExpResult(1, 2) = 48;
296 MultTest3x2BTimes2x3AExpResult(2, 0) = 48; MultTest3x2BTimes2x3AExpResult(2, 1) = 66; MultTest3x2BTimes2x3AExpResult(2, 2) = 84;
299 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 2x2 * 2x2", MultTest2x2ATimes2x2B, MultTest2x2ATimes2x2BExpResult, verbose);
301 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 2x2 * 2x2", MultTest2x2BTimes2x2A, MultTest2x2BTimes2x2AExpResult, verbose);
303 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 3x3 * 3x3", MultTest3x3ATimes3x3B, MultTest3x3ATimes3x3BExpResult, verbose);
305 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 3x3 * 3x3", MultTest3x3BTimes3x3A, MultTest3x3BTimes3x3AExpResult, verbose);
307 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 2x3 * 3x2", MultTest2x3ATimes3x2B, MultTest2x3ATimes3x2BExpResult, verbose);
309 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 2x3 * 3x2", MultTest2x3BTimes3x2A, MultTest2x3BTimes3x2AExpResult, verbose);
311 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 3x2 * 2x3", MultTest3x2ATimes2x3B, MultTest3x2ATimes2x3BExpResult, verbose);
313 numberFailedTests +=
PrintTestResults(
"multiply() -- mult. results -- 3x2 * 2x3", MultTest3x2BTimes2x3A, MultTest3x2BTimes2x3AExpResult, verbose);
315 DMatrix MultTestHugeA, MultTestHugeB, MultTestHugeATimesHugeBExpResult,
316 MultTestHugeATimesHugeB;
318 const int hugeSize = 100;
319 MultTestHugeA.shape(hugeSize, hugeSize);
320 MultTestHugeB.shape(hugeSize, hugeSize);
321 MultTestHugeATimesHugeBExpResult.shape(hugeSize, hugeSize);
322 MultTestHugeATimesHugeB.shape(hugeSize, hugeSize);
324 for(i = 0; i < hugeSize; i++)
326 for(j = 0; j < hugeSize; j++)
328 MultTestHugeA(i, j) = j;
329 MultTestHugeB(i, j) = i;
330 MultTestHugeATimesHugeBExpResult(i, j) = 328350;
335 MultTestHugeA, MultTestHugeB, 1.0);
337 "multiply() -- mult. results -- huge * huge",
338 MultTestHugeATimesHugeB, MultTestHugeATimesHugeBExpResult, verbose);
346 if (verbose) std::cout <<
"scale() -- scale matrix by some number ";
347 returnCode = ScalTest.scale( 8.0 );
348 if (ScalTest(2, 3) == 8.0) {
349 if (verbose) std::cout<<
"successful." <<std::endl;
351 if (verbose) std::cout<<
"unsuccessful." <<std::endl;
356 if (verbose) std::cout <<
"scale() -- point-wise scale matrix ";
357 ScalTest.scale( ScalTest2 );
358 if (ScalTest.normOne() == 0.0) {
359 if (verbose) std::cout<<
"successful." <<std::endl;
361 if (verbose) std::cout<<
"unsuccessful." <<std::endl;
369 testName =
"random() -- enter random entries into matrix";
370 returnCode = CCC.random();
371 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 0, verbose);
373 testName =
"putScalar() -- set every entry of this matrix to 1.0";
375 numberFailedTests +=
ReturnCodeCheck(testName, returnCode, 0, verbose);
379 if (verbose) std::cout <<
"assign() -- copy the values of an input matrix ";
381 if (verbose) std::cout<<
"successful" <<std::endl;
383 if (verbose) std::cout<<
"unsuccessful" <<std::endl;
391 if (verbose) std::cout <<
"swap() -- swap the values and attributes of two matrices -- ";
393 bool op_result = ( (CCCswap == copyCCC) && (CCC == copyCCCswap) );
395 std::cout << (op_result ?
"successful" :
"failed" )<<std::endl;
405 if (verbose) std::cout <<
"operator= -- small(empty) = large(view) ";
406 if (CCCtest1.numRows()==3 && CCCtest1.values()==CCC.values()) {
407 if (verbose) std::cout<<
"successful" <<std::endl;
409 if (verbose) std::cout<<
"unsuccessful" <<std::endl;
413 if (verbose) std::cout <<
"operator= -- small(view) = large(copy) ";
414 if (CCCtest1.numRows()==5 && CCCtest1.values()!=CCC.values()) {
415 if (verbose) std::cout<<
"successful"<<std::endl;
417 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
423 if (verbose) std::cout <<
"operator= -- large(copy) = small(copy) ";
424 if (CCCtest1.numRows()==2 ) {
425 if (verbose) std::cout<<
"successful"<<std::endl;
427 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
431 if (verbose) std::cout <<
"operator= -- large(copy) = small(view) ";
432 if (CCCtest1.numRows()==3 && CCCtest1.stride()==5) {
433 if(verbose) std::cout<<
"successful" <<std::endl;
435 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
440 CCCtest1 += CCCtest3;
441 if (verbose) std::cout <<
"operator+= -- add two matrices of the same size, but different leading dimension ";
442 if (CCCtest1(1,1)==2.0) {
443 if(verbose) std::cout<<
"successful" <<std::endl;
445 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
448 if (verbose) std::cout <<
"operator+= -- add two matrices of different size (nothing should change) ";
450 if (CCCtest1(1,1)==2.0) {
451 if(verbose) std::cout<<
"successful" <<std::endl;
453 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
460 MultTestHugeATimesHugeB.reshape(10, 10);
461 op_result = (MultTestHugeATimesHugeB == MultTestHugeATimesHugeBExpResult);
463 std::cout <<
"operator== -- results -- small == huge "<< (op_result ==
false ?
"successful" :
"failed" )<<std::endl;
465 op_result = (MultTestHugeATimesHugeB != MultTestHugeATimesHugeBExpResult);
467 std::cout <<
"operator!= -- results -- small != huge "<< (op_result ==
true ?
"successful" :
"failed" )<<std::endl;
468 std::cout << std::endl<< MultTestHugeATimesHugeB << std::endl;
475 if (verbose) std::cout<<std::endl<<
"********** CHECKING TEUCHOS SERIAL DENSE VECTOR **********"<<std::endl<<std::endl;
478 if (verbose) std::cout <<
"default constructor -- construct empty std::vector ";
479 if ( DefConTestV.values()!=NULL || DefConTestV.length()!=0 || DefConTestV.numRows()!=0 ||DefConTestV.stride()!=0 ) {
480 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
483 if (verbose) std::cout <<
"successful."<<std::endl;
489 if (verbose) std::cout <<
"constructor 1 -- empty std::vector with given dimensions ";
490 if ( Con1TestV.length()!=3 || Con1TestV.numCols()!=1 || Con1TestV( 1 )!=0.0 ) {
491 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
494 if (verbose) std::cout <<
"successful."<<std::endl;
500 if (verbose) std::cout <<
"constructor 2 -- construct std::vector from array subrange ";
501 if ( Con2Test1V.numRows()!=4 || Con2Test1V.numCols()!=1 || Con2Test1V[ 2 ]!=2.0 ) {
502 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
505 if (verbose) std::cout <<
"successful."<<std::endl;
510 DVector Con3TestCopyV( Con2Test1V );
511 if(verbose) std::cout <<
"constructor 3 -- copy constructor ";
512 if ( Con3TestCopyV != Con2Test1V ) {
513 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
516 if (verbose) std::cout <<
"successful."<<std::endl;
523 if (verbose) std::cout <<
"non-method helper function -- construct vector view of second column of matrix ";
524 if ( ColViewTestV.normInf() != 1.0 || ColViewTestV.normOne() != 3.0 ) {
525 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
528 if (verbose) std::cout <<
"successful."<<std::endl;
533 numberFailedTests +=
PrintTestResults(
"normOne of a 3x1 std::vector", Con2Test1V.normOne(), 6.0, verbose);
534 numberFailedTests +=
PrintTestResults(
"normInf of a 3x1 std::vector", Con2Test1V.normInf(), 3.0, verbose);
536 numberFailedTests +=
PrintTestResults(
"normFrobenius of a 3x1 std::vector", Con2Test1V.normFrobenius(), 2.0, verbose);
541 SizeTestV1.
size( 5 );
542 if(verbose) std::cout <<
"size() -- test ";
543 if (SizeTestV1( 4 )!= 0.0) {
544 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
547 if (verbose) std::cout <<
"successful."<<std::endl;
550 SizeTestV1.resize( 10 );
551 if(verbose) std::cout <<
"resize() -- test small --> large ";
552 if (SizeTestV1[ 4 ]!= 2.0 || SizeTestV1[ 8 ]!=0.0 ) {
553 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
556 if (verbose) std::cout <<
"successful."<<std::endl;
558 SizeTestV1.resize( 3 );
559 if(verbose) std::cout <<
"resize() -- test large --> small ";
560 if (SizeTestV1( 2 )!= 2.0) {
561 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
564 if (verbose) std::cout <<
"successful."<<std::endl;
570 OpEqTestV3 = OpEqTestV2;
571 if (verbose) std::cout <<
"operator= -- small(empty) = large(view) ";
572 if (OpEqTestV3.length()==3 && OpEqTestV3.values()==OpEqTestV2.values()) {
573 if (verbose) std::cout<<
"successful"<<std::endl;
575 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
578 OpEqTestV3 = OpEqTestV1;
579 if (verbose) std::cout <<
"operator= -- small(view) = large(copy) ";
580 if (OpEqTestV3.length()==10 && OpEqTestV3.values()!=OpEqTestV1.values()) {
581 if (verbose) std::cout<<
"successful"<<std::endl;
583 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
587 OpEqTestV3 = OpEqTestV1;
588 if (verbose) std::cout <<
"operator= -- small(copy) = large(copy) ";
589 if (OpEqTestV3.length()==10 && OpEqTestV3.values()!=OpEqTestV1.values() && OpEqTestV3[ 9 ]==3.0) {
590 if (verbose) std::cout<<
"successful"<<std::endl;
592 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
596 DVector OpSumTestV1( OpEqTestV2 );
597 OpSumTestV1 += OpEqTestV2;
598 if (verbose) std::cout <<
"operator+= -- add two vectors of the same size, but different leading dimension ";
599 if (OpSumTestV1( 1 )==6.0) {
600 if (verbose) std::cout<<
"successful" <<std::endl;
602 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
605 if (verbose) std::cout <<
"operator+= -- add two vectors of different size (nothing should change) ";
606 OpSumTestV1 += OpEqTestV1;
607 if (OpSumTestV1( 1 )==6.0) {
608 if (verbose) std::cout<<
"successful" <<std::endl;
610 if (verbose) std::cout<<
"unsuccessful"<<std::endl;
616 if(verbose) std::cout <<
"operator== -- test large == small ";
617 if (OpCompTestV1 == SizeTestV1) {
618 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
621 if (verbose) std::cout <<
"successful."<<std::endl;
623 if(verbose) std::cout <<
"operator!= -- test large != small ";
624 if (OpCompTestV1 != SizeTestV1) {
625 if (verbose) std::cout <<
"successful."<<std::endl;
627 if (verbose) std::cout <<
"successful."<<std::endl;
631 DVector ColSetTestV( AAA.numRows() );
632 ColSetTestV.putScalar( 2.0 );
634 if (verbose) std::cout <<
"non-method helper function -- set second column of matrix with vector ";
635 if ( ColViewTestV.normInf() != 2.0 || ColViewTestV.normOne() != 6.0 || ret ==
false ) {
636 if (verbose) std::cout <<
"unsuccessful."<<std::endl;
639 if (verbose) std::cout <<
"successful."<<std::endl;
644 if(numberFailedTests > 0)
647 std::cout <<
"Number of failed tests: " << numberFailedTests << std::endl;
648 std::cout <<
"End Result: TEST FAILED" << std::endl;
652 if(numberFailedTests == 0)
653 std::cout <<
"End Result: TEST PASSED" << std::endl;