Revision 692 branches/merge-trunk-davef/src/df1b2-separable/df1b2lp8.cpp

df1b2lp8.cpp (revision 692)
403 403
{
404 404
  //int i,j,ip; 
405 405
  int i,ip; 
406
  if (quadratic_prior::get_num_quadratic_prior()>0)
406
  if (quadratic_prior::get_num_quadratic_prior()>0 && 
407
     quadratic_prior::sparse_flag==0)
407 408
  {
408 409
    hesstype=4;
409 410
    if (allocated(Hess))
......
470 471
  
471 472
      quadratic_prior::in_qp_calculations=1; 
472 473

  
474
      int nsc=0;
473 475
      if (sparse_hessian_flag)
474 476
      {
475 477
        // just to get the number of separable calls
476 478
        separable_calls_counter=0;
477 479
        pfmin->AD_uf_inner();
478 480
        // allocate space for uncompressed sparse hessian information
481
        nsc=separable_calls_counter;
479 482

  
480
        //num_separable_calls=separable_calls_counter;
483
        if (quadratic_prior::get_num_quadratic_prior()>0 && 
484
          quadratic_prior::sparse_flag==1)
485
        {
486
          nsc+=1;
487
        }
481 488
        if (triplet_information==0) 
482 489
        {
483
          triplet_information =new i3_array(1,separable_calls_counter);
490
          triplet_information =new i3_array(1,nsc);
484 491
        }
485
        else if ( triplet_information->indexmax() != separable_calls_counter) 
492
        else if ( triplet_information->indexmax() != nsc) 
486 493
        {
487 494
          delete triplet_information;
488
          triplet_information =new i3_array(1,separable_calls_counter);
495
          triplet_information =new i3_array(1,nsc);
489 496
        }
490 497
        triplet_information->initialize();
491 498
        separable_calls_counter=0;
......
493 500

  
494 501
      pfmin->pre_user_function();
495 502

  
503
      if (quadratic_prior::get_num_quadratic_prior()>0 && 
504
          quadratic_prior::sparse_flag==1)
505
      {
506
        pfmin->inner_opt_flag=1;
507
        quadratic_prior::calc_matrix_flag=1;
508
        quadratic_prior::matrix_mult_flag=0;
509
        df1b2quadratic_prior::ptr[0]->get_cM();
510
        quadratic_prior::ptr[0]->get_cM();
511
        pfmin->inner_opt_flag=0;
512
        quadratic_prior::calc_matrix_flag=0;
496 513

  
514
        (*triplet_information)(nsc)=quadratic_prior::ptr[0]->SCM->get_coords();
515
        //imatrix * tmp=new imatrix(quadratic_prior::ptr[0]->SCM->get_coords());
516
      }
517
      int non_block_diagonal=0;
518

  
497 519
      if (sparse_hessian_flag)
498 520
      {
499
        // turn triplet_informaiton into  compressed_triplet_information 
521
        // if we have a sparse_quadratic_prior object
522
        // get extra stuff for sparseness
523
        non_block_diagonal=1;
524
        // turn triplet_information into  compressed_triplet_information 
525
        if (pfmin->spqp)
526
        {
527
          imatrix tmp;
528
          pfmin->get_sparse_stuff(&tmp,1);
529
        }
500 530
        int mmin= triplet_information->indexmin();
501 531
        int mmax= triplet_information->indexmax();
502 532
        int i;
......
505 535
        {
506 536
          if (allocated((*triplet_information)(i)))
507 537
          {
538
            if (i==mmax)
539
            {
540
              sparse_cutoff=ndim;
541
              //cout << "HERE" << endl;
542
            }
508 543
            ndim+=(*triplet_information)(i,1).indexmax();
509 544
          }
510 545
        }
......
514 549
          compressed_triplet_information=0;
515 550
        }
516 551
        compressed_triplet_information=new imatrix(1,ndim,1,3);
517
        (*compressed_triplet_information)(3).fill_seqadd(1,1);
552
        //(*compressed_triplet_information)(3).fill_seqadd(1,1);
518 553
        int ii=0;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff