Test of multiply method, of class SparseVector.
()
| 340 | * Test of multiply method, of class SparseVector. |
| 341 | */ |
| 342 | @Test |
| 343 | public void testMultiply() |
| 344 | { |
| 345 | System.out.println("multiply"); |
| 346 | double c = 0.5; |
| 347 | Matrix A = Matrix.pascal(20); |
| 348 | Vec b = new DenseVector(20); |
| 349 | |
| 350 | x.multiply(c, A, b); |
| 351 | |
| 352 | DenseVector truth = new DenseVector(new double[] |
| 353 | { |
| 354 | 9.50000000000000e+00, |
| 355 | 1.17000000000000e+02, |
| 356 | 1.02400000000000e+03, |
| 357 | 6.79100000000000e+03, |
| 358 | 3.65035000000000e+04, |
| 359 | 1.66677000000000e+05, |
| 360 | 6.67777000000000e+05, |
| 361 | 2.40242100000000e+06, |
| 362 | 7.89524000000000e+06, |
| 363 | 2.40138700000000e+07, |
| 364 | 6.82963280000000e+07, |
| 365 | 1.83124137000000e+08, |
| 366 | 4.66043078500000e+08, |
| 367 | 1.13203426200000e+09, |
| 368 | 2.63681749700000e+09, |
| 369 | 5.91310906500000e+09, |
| 370 | 1.28100303500000e+10, |
| 371 | 2.68885048480000e+10, |
| 372 | 5.48258186510000e+10, |
| 373 | 1.08840104671000e+11, |
| 374 | }); |
| 375 | |
| 376 | assertTrue(b.equals(truth, 1e-13)); |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * Test of mutableAdd method, of class SparseVector. |