File: superalignmentpairwiseplen.cpp

package info (click to toggle)
iqtree 1.6.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,140 kB
  • sloc: cpp: 111,752; ansic: 53,619; python: 242; sh: 195; makefile: 52
file content (47 lines) | stat: -rw-r--r-- 1,420 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
//  superalignmentpairwiseplen.cpp
//  iqtree
//
//  Created by Olga on 04/05/17.
//
//

#include <stdio.h>
#include "superalignmentpairwiseplen.h"

/**********************************************************
 * class SuperAlignmentPairwisePlen
 **********************************************************/


SuperAlignmentPairwisePlen::SuperAlignmentPairwisePlen(PhyloSuperTreePlen *atree, int seq1, int seq2)
: SuperAlignmentPairwise((PhyloSuperTree*) atree, seq1, seq2)
{
    part_info = &(atree->part_info);
}

double SuperAlignmentPairwisePlen::computeFunction(double value) {
    int part = 0;
    double lh = 0.0;
    for (vector<AlignmentPairwise*>::iterator it = partitions.begin(); it != partitions.end(); it++, part++) {
        lh += (*it)->computeFunction(part_info->at(part).part_rate*value);
    }
    return lh;
}

void SuperAlignmentPairwisePlen::computeFuncDerv(double value, double &df, double &ddf) {
    int part = 0;
    //	double lh = 0.0;
    df = 0.0;
    ddf = 0.0;
    for (vector<AlignmentPairwise*>::iterator it = partitions.begin(); it != partitions.end(); it++, part++) {
        double d1, d2;
        (*it)->computeFuncDerv(part_info->at(part).part_rate*value, d1, d2);
        df += part_info->at(part).part_rate*d1;
        ddf += part_info->at(part).part_rate*part_info->at(part).part_rate*d2;
    }
    //	return lh;
}

SuperAlignmentPairwisePlen::~SuperAlignmentPairwisePlen()
{}