package Algorism @ISA = qw() sub InterpolateValuesInCube my ($nx, $ny, $nz, $pValues, $x, $y, $z) = @_; return $pValues->[$ix][$iy][$iz]; sub Convolution my ($pX, $pY, $Width, $Function, $IgnoreZeroValue) = @_; return \@y; sub minver my ($A) = @_; return $A->inverse(); sub lstsq my ($pX, $pY, $n, $m, $c) = @_; return 999 if($m >= $n or $m < 1); return 0; sub SolveByNewton my ($func, $iniX, $dX, $Xth, $fth, $nMaxIter) = @_; return $x; sub IsFactor my ($I, $idiv) = @_; return 0 if($idiv <= 0); return 1 if(abs($res) < 1.0e-10); return 0; sub Factorize my ($I) = @_; return @e; sub SmoothingBySimpleAverage my ($pY, $n) = @_; return \@y; sub AdaptiveSmoothing my ($pY, $n) = @_; return \@y; sub IntegrateByRectangle my ($pX, $pY) = @_; return undef if($nData < 2); return \@y; sub IntegrateByTrapezoid my ($pX, $pY) = @_; return undef if($nData < 2); return \@y; sub SinglePointIntegrateByConstantStepSimpson my ($nData, $h, $pY) = @_; return undef; return $S; sub SinglePointIntegrateBySimpson my ($pX, $pY) = @_; return undef; return $S; sub IntegrateByConstantStepSimpson my ($nData, $h, $pY) = @_; return undef if($nData < 2); return \@y; sub IntegrateBySimpson my ($pX, $pY) = @_; return undef if($nData < 2); return \@y; sub IntegrateByConstantStepBode my ($nData, $h, $pY) = @_; return undef if($nData < 2); return \@y; sub IntegrateByCubicSpline my ($pX, $pY) = @_; return undef; return undef; return $w * 0.5; sub DifferentiateByLinearAverage my ($pX, $pY) = @_; return undef if($nData < 2); return \@y; sub DifferentiateByLagrange my ($pX, $pY, $x) = @_; return undef; return undef; return $w; sub DifferentiateByCubicSpline my ($pX, $pY, $x) = @_; return undef; return undef; return $diff; return undef; sub FindIndexByBinarySearch my ($pX, $x) = @_; return 0 if($x <= $pX->[0]); return $nData - 1 if($pX->[$nData-1] <= $x); return $idxh if(($x1 - $x) * ($xh - $x) == 0.0); return undef; return $idx0; sub Interpolate my ($pX, $pY, $x) = @_; return $pY->[0] if($x <= $pX->[0]); return $pY->[$nData-1] if($x >= $pX->[$nData-1]); return $pY->[$idx] + $k * ($x - $pX->[$idx]); sub InterpolateForConstantStepX my ($nData, $x0, $dx, $pY, $x) = @_; return $pY->[0] if($idx < 0); return $pY->[$nData-1] if($idx >= $nData); return $pY->[$idx]; return $pY->[$idx] + $k * ($x - $xa); sub InterpolateByLagrange my ($pX, $pY, $x) = @_; return undef; return $w; sub InterpolateBySimpson my ($pX, $pY, $x) = @_; return $pY->[0] if($x <= $pX->[0]); return $pY->[$nData-1] if($x >= $pX->[$nData-1]); return $y; sub InterpolateBy4thPolynomial my ($pX, $pY, $x) = @_; return $pY->[0] if($x <= $pX->[0]); return $pY->[$nData-1] if($x >= $pX->[$nData-1]); return $y; sub InterpolateByCubicSpline my ($pX, $pY, $x) = @_; return undef if($nData < 3); return $pY->[0] if($x <= $pX->[0]); return $pY->[$nData-1] if($x >= $pX->[$nData-1]); return undef; return $v / $hi / 6.0; return undef; sub subspl my ($pX, $pY) = @_; return (\@h, \@sp);