Ejemplo n.º 1
0
/*!
 * \brief Reading::errorPropagationPolarToCart
 * Variance propagation to get sigma values for cartesian coordinates
 * \return
 */
OiVec Reading::errorPropagationPolarToCart(){
    OiVec sigmaCartXyz;

    OiMat F(3,3);
    F.setAt(0, 0, qSin(this->rPolar.zenith) * qCos(this->rPolar.azimuth));
    F.setAt(0, 1, this->rPolar.distance * qSin(this->rPolar.zenith) * -qSin(this->rPolar.azimuth));
    F.setAt(0, 2, this->rPolar.distance * qCos(this->rPolar.zenith) * qCos(this->rPolar.azimuth));
    F.setAt(1, 0, qSin(this->rPolar.zenith) * qSin(this->rPolar.azimuth));
    F.setAt(1, 1, this->rPolar.distance * qSin(this->rPolar.zenith) * qCos(this->rPolar.azimuth));
    F.setAt(1, 2, this->rPolar.distance * qCos(this->rPolar.zenith) * qSin(this->rPolar.azimuth));
    F.setAt(2, 0, qCos(this->rPolar.zenith));
    F.setAt(2, 1, 0.0);
    F.setAt(2, 2, this->rPolar.distance * -qSin(this->rPolar.zenith));

    OiMat Sll(3,3);
    Sll.setAt(0, 0, this->rPolar.sigmaDistance * this->rPolar.sigmaDistance);
    Sll.setAt(1, 1, this->rPolar.sigmaAzimuth * this->rPolar.sigmaAzimuth);
    Sll.setAt(2, 2, this->rPolar.sigmaZenith * this->rPolar.sigmaZenith);

    OiMat Qxx = F * Sll * F.t();

    //transform Qxx into homogeneous coordinates
    OiMat Qxx_hc(4,4);
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            Qxx_hc.setAt(i,j, Qxx.getAt(i,j));
        }
    }

    sigmaCartXyz.add(qSqrt(Qxx.getAt(0,0)));
    sigmaCartXyz.add(qSqrt(Qxx.getAt(1,1)));
    sigmaCartXyz.add(qSqrt(Qxx.getAt(2,2)));
    sigmaCartXyz.add(1.0);

    if(this->obs != NULL){
        this->obs->myStatistic.qxx = Qxx_hc;
        this->obs->myStatistic.s0_apriori = 1.0;
        this->obs->myOriginalStatistic = this->obs->myStatistic;
    }

    return sigmaCartXyz;
}
Ejemplo n.º 2
0
void excute(){
    if(stall){
        extype = 0;
        EX = "NOP";
    }else {
        extype = idtype;
        EX = ID;
    }
    if(strcmp(EX,"ADD") == 0){
        if(Add(rs,rt,rd) < 0){
            error_no = 1;
        }
    }else if(strcmp(EX,"SUB") == 0){
        if(Sub(rs,rt,rd) < 0){
            error_no = 1;
        }
    }else if(strcmp(EX,"ADDU") == 0){
        Add(rs,rt,rd);
    }else if(strcmp(EX,"AND") == 0){
        And(rs,rt,rd);
    }else if(strcmp(EX,"OR") == 0){
        Or(rs,rt,rd);
    }else if(strcmp(EX,"XOR") == 0){
        Xor(rs,rt,rd);
    }else if(strcmp(EX,"NOR") == 0){
        Nor(rs,rt,rd);
    }else if(strcmp(EX,"NAND") == 0){
        Nand(rs,rt,rd);
    }else if(strcmp(EX,"SLT") == 0){
        Slt(rs,rt,rd);
    }else if(strcmp(EX,"SLL") == 0){
        Sll(rt,rd,shamt);
    }else if(strcmp(EX,"SRL") == 0){
        Srl(rt,rd,shamt);
    }else if(strcmp(EX,"SRA") == 0){
        Sra(rt,rd,shamt);
    }else if(strcmp(EX,"JR") == 0){
        PC = registers[rs];
    }else if(strcmp(EX,"ADDI") == 0){
        if(Addi(rs,rt,imm)<0){
            error_no = 1;
        }
    }else if(strcmp(EX,"ADDIU") == 0){
        Addiu(rs,rt,imm);
    }else if(strcmp(EX,"LW") == 0){
        Lw(rs,rt,imm);
    }else if(strcmp(EX,"LH") == 0){
        Lh(rs,rt,imm);
    }else if(strcmp(EX,"LHU") == 0){
        Lhu(rs,rt,imm);
    }else if(strcmp(EX,"LB") == 0){
        Lb(rs,rt,imm);
    }else if(strcmp(EX,"LBU") == 0){
        Lbu(rs,rt,imm);
    }else if(strcmp(EX,"SW") == 0){
        Sw(rs,rt,imm);
    }else if(strcmp(EX,"SH") == 0){
        Sh(rs,rt,imm);
    }else if(strcmp(EX,"SB") == 0){
        Sb(rs,rt,imm);
    }else if(strcmp(EX,"LUI") == 0){
        Lui(rt,imm);
    }else if(strcmp(EX,"ANDI") == 0){
        Andi(rs,rt,imm);
    }else if(strcmp(EX,"ORI") == 0){
        Ori(rs,rt,imm);
    }else if(strcmp(EX,"NORI") == 0){
        Nori(rs,rt,imm);
    }else if(strcmp(EX,"SLTI") == 0){
        Slti(rs,rt,imm);
    }else if(strcmp(EX,"JAL") == 0){
        registers[31] = PC;
        PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4;
    }else if(strcmp(EX,"J") == 0){
        PC = (PC)/(int)(Pow(2,28)+0.01)*(int)(Pow(2,28)+0.01) + ads*4;
    }/*else if(strcmp(EX,"BEQ") == 0 || strcmp(EX,"BNE") == 0 || strcmp(EX,"BGTZ") == 0){
        PC = go;
    }*/


}