Welcome Guest, Not a member yet? Register   Sign In
when i used with "Matrix" for compute i got these problem
#1

[eluser]Unknown[/eluser]
i created a function to compute some value with Matrix (math) and i got these problem

when i sent value to these "function" i got a result but the system show that error .



Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: controllers/ahpprocess.php

Line Number: 317

// -----------------

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 2

Filename: controllers/ahpprocess.php

Line Number: 318

i don't understand with "Message : Undefined offset :2" , i'll show my source code below.

too long ; ))

Code:
$A0[0]=$this->input->post('A0');//position 1
    $A0[1]=$this->input->post('A1');//language
            
    //input from user #position
    $B0[0]=$this->input->post('B0');//B1:B2
    $B0[1]=$this->input->post('B1');
    $B0[2]=$this->input->post('B2');//B2:B3
    $B0[3]=$this->input->post('B3');
    $B0[4]=$this->input->post('B4');//B1:B3
    $B0[5]=$this->input->post('B5');
            
    //input from user #language
    $B0[6]= $this->input->post('B6');//B1:B2
    $B0[7] = $this->input->post('B7');
    $B0[8]=$this->input->post('B8');//B2:B3
    $B0[9]=$this->input->post('B9');
    $B0[10]=$this->input->post('B10');//B1:B3
    $B0[11]= $this->input->post('B11');
      
    $company1 = $this->input->post('company1');
    $company2 = $this->input->post('company2');
    $company3 = $this->input->post('company3');
            
     //=============================================
            
            
            
     //process position vs language
     $A1[0][0]=$A0[0]/$A0[0];
     $A1[1][0]=$A0[1]/$A0[0];
     $A1[0][1]=$A0[0]/$A0[1];
     $A1[1][1]=$A0[1]/$A0[1];
            
     $sum1=$A1[0][0]+$A1[0][1];
     $sum2=$A1[1][0]+$A1[1][1];
            
     $A2[0]=((($A1[0][0]/$sum1)+($A1[1][0]/$sum2))/2)*100;//66%
     $A2[1]=((($A1[0][1]/$sum1)+($A1[1][1]/$sum2))/2)*100;//33%  
     //-----------------------------------------------------------
            
     //process position
     $B1[0][0]=1;
     $B1[1][0]=$B0[1]/$B0[0];
     $B1[2][0]=$B0[5]/$B0[4];
     $B1[0][1]=$B0[0]/$B0[1];
     $B1[1][1]=1;
     $B1[2][1]=$B0[3]/$B0[2];
     $B1[0][2]=$B0[4]/$B0[5];
     $B1[1][2]=$B0[2]/$B0[3];
     $B1[2][2]=1;
              
     $sum1=$B1[0][0]+$B1[0][1]+$B1[0][2];
     $sum2=$B1[1][0]+$B1[1][1]+$B1[1][2];
     $sum3=$B1[2][0]+$B1[2][1]+$B1[2][2];
              
     //result position
     $B2[0][0]=(((($B1[0][0]/$sum1)+($B1[1][0]/$sum2)+($B1[2][0]/$sum3))/3)*1)*($A2[0]/100);
     $B2[0][1]=(((($B1[0][1]/$sum1)+($B1[1][1]/$sum2)+($B1[2][1]/$sum3))/3)*1)*($A2[0]/100);
     $B2[0][2]=(((($B1[0][2]/$sum1)+($B1[1][2]/$sum2)+($B1[2][2]/$sum3))/3)*1)*($A2[0]/100);
              
              
     //input from user #language
     $B0[0]=$B0[6];//B1:B2
     $B0[1]=$B0[7];
     $B0[2]=$B0[8];//B2:B3
     $B0[3]=$B0[9];
     $B0[4]=$B0[10];//B1:B3
     $B0[5]=$B0[11];
              
              //process language
              $B1[0][0]=1;
              $B1[1][0]=$B0[1]/$B0[0];
              $B1[2][0]=$B0[5]/$B0[4];
              $B1[0][1]=$B0[0]/$B0[1];
              $B1[1][1]=1;
              $B1[2][1]=$B0[3]/$B0[2];
              $B1[0][2]=$B0[4]/$B0[5];
              $B1[1][2]=$B0[2]/$B0[3];
              $B1[2][2]=1;
              
              $sum1=$B1[0][0]+$B1[0][1]+$B1[0][2];
              $sum2=$B1[1][0]+$B1[1][1]+$B1[1][2];
              $sum3=$B1[2][0]+$B1[2][1]+$B1[2][2];
              
      //result language
      $B2[1][0]=(((($B1[0][0]/$sum1)+($B1[1][0]/$sum2)+($B1[2][0]/$sum3))/3)*1)*($A2[1]/100);
      $B2[1][1]=(((($B1[0][1]/$sum1)+($B1[1][1]/$sum2)+($B1[2][1]/$sum3))/3)*1)*($A2[1]/100);
      $B2[1][2]=(((($B1[0][2]/$sum1)+($B1[1][2]/$sum2)+($B1[2][2]/$sum3))/3)*1)*($A2[1]/100);
            
      $key1=round((($B2[0][0]+$B2[1][0])*100),2);//company A
      
      //[b] -- 317 [/b]
      $key2=round((($B2[1][1]+$B2[2][1])*100),2);//company B
      
      $key3=round((($B2[1][2]+$B2[2][2])*100),2);//company C
      //[b] -- 318 [/b]
      
              $B3["$key1"]=$company1;
              $B3["$key2"]=$company2;
              $B3["$key3"]=$company3;
            
              krsort($B3);
              
              // put it on $data
              $data['result'] = $B3;

Please help me ., to solve these problem i don't have any idea to solve it, Thankyou. Wink)




Theme © iAndrew 2016 - Forum software by © MyBB