Пример #1
0
 public function mul($other)
 {
     return mul($this, $other);
 }
Пример #2
0
 public function getBPByPropByCalc($prop = array())
 {
     $this->load->helper('vector');
     $invTnt = array();
     //注意!invTnt[0-4]*[hmade]^-1 = 100000 *[xgfmm]!!!! BP是100000倍,而random表是100倍。
     $invTnt[] = array(13.24901855, -0.806318907, -6.785929774, -10.93898148, -16.40847223);
     $invTnt[] = array(-0.782811067, -0.608853052, 38.607709, -2.429143453, -3.643715179);
     $invTnt[] = array(-0.69583206, -0.541202713, -2.719073478, 34.87779841, -3.238857937);
     $invTnt[] = array(-0.467806013, -0.363849121, -2.954151876, -2.452651293, 51.87657862);
     $invTnt[] = array(-0.935612027, 10.38341287, -5.908303753, -4.905302585, -7.357953878);
     $result = array();
     $prop = minus($prop, mul(1, array(20, 20, 20, 20, 20)));
     for ($i = 0; $i < 5; $i++) {
         $result[$i] = 0;
         for ($j = 0; $j < 5; $j++) {
             $result[$i] += $invTnt[$i][$j] * $prop[$j] / 100;
         }
     }
     return $result;
 }
Пример #3
0
 function init_with_array(array $integer_array)
 {
     $integer_array = array_map("force_32_bit_int", $integer_array);
     $mt =& $this->mt;
     $mti =& $this->mti;
     $key_length = count($integer_array);
     $this->init_with_integer(19650218);
     $i = 1;
     $j = 0;
     $k = N > $key_length ? N : $key_length;
     for (; $k; $k--) {
         $mt[$i] = add_3($mt[$i] ^ mul_by_1664525($mt[$i - 1] ^ $mt[$i - 1] >> 30 & 3), $integer_array[$j], $j);
         /*
           mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL))
             + init_key[j] + j;
         */
         $i++;
         $j++;
         if ($i >= N) {
             $mt[0] = $mt[N - 1];
             $i = 1;
         }
         if ($j >= $key_length) {
             $j = 0;
         }
     }
     for ($k = N - 1; $k; $k--) {
         $mt[$i] = sub($mt[$i] ^ mul($mt[$i - 1] ^ $mt[$i - 1] >> 30 & 3, 1566083941), $i);
         /*
           mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL))
             - i;
         */
         $i++;
         if ($i >= N) {
             $mt[0] = $mt[N - 1];
             $i = 1;
         }
     }
     $mt[0] = 1 << 31;
     /* MSB is 1; assuring non-zero initial array */
 }
Пример #4
0
    {
        echo "Welcome to new use of trait";
    }
}
class father_of_trait
{
    use use_of_trait;
}
father_of_trait::greetings();
echo "<br/>";
\mamun\use_of_namespace::confused();
//imported from another page and i used namespace
//Expression:
function mul($i)
{
    return $i * 2;
}
$a = 5;
$c = $a++;
echo $c;
$d = 7;
echo mul(++$d);
$a = 20;
echo "<br/>";
$c = $a-- - $a--;
echo "the value is : {$c}";
echo "<br/>";
echo $a;
?>
 </body>
 </html>
Пример #5
0
<?php

function mul($i, $j)
{
    return $i * $j;
}
echo "<html><table>\n\n";
for ($i = 1; $i <= 10; $i++) {
    echo "<tr>\n";
    for ($j = 1; $j <= 10; $j++) {
        echo " <td>" . mul($i, $j) . "</td>\n";
    }
    echo "</tr>\n\n";
}
echo "\n</table></html>\n";
Пример #6
0
<?php

$a = 5;
$b = 6;
$choice = 'mul';
switch ($choice) {
    case 'add':
        $c = add($a, $b);
        echo "The " . $choice . " is " . $c . "<br/>";
        break;
    case 'sub':
        $c = sub($a, $b);
        echo "The " . $choice . " is " . $c . "<br/>";
        break;
    case 'mul':
        $c = mul($a, $b);
        echo "The " . $choice . " is " . $c . "<br/>";
        break;
    case 'div':
        $c = div($a, $b);
        echo "The " . $choice . " is " . $c . "<br/>";
        break;
    default:
        echo "Enter a valid option";
}
function add($a, $b)
{
    return $a + $b;
}
function sub($a, $b)
{