[LON-CAPA-cvs] cvs: loncom / startup.pl /homework default_homework.lcpm /xml lonxml.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 26 Sep 2005 21:39:55 -0000
albertel Mon Sep 26 17:39:55 2005 EDT
Modified files:
/loncom/homework default_homework.lcpm
/loncom/xml lonxml.pm
/loncom startup.pl
Log:
- adding Math::Complex and Math::Cephes::Matrix
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.102 loncom/homework/default_homework.lcpm:1.103
--- loncom/homework/default_homework.lcpm:1.102 Tue Aug 2 14:47:24 2005
+++ loncom/homework/default_homework.lcpm Mon Sep 26 17:39:53 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
#
-# $Id: default_homework.lcpm,v 1.102 2005/08/02 18:47:24 albertel Exp $
+# $Id: default_homework.lcpm,v 1.103 2005/09/26 21:39:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -451,14 +451,14 @@
return @retArray;
}
-sub abs { abs(shift) }
-sub sin { sin(shift) }
-sub cos { cos(shift) }
-sub exp { exp(shift) }
-sub int { int(shift) }
-sub log { log(shift) }
-sub atan2 { atan2($_[0],$_[1]) }
-sub sqrt { sqrt(shift) }
+sub abs { CORE::abs(shift) }
+sub sin { CORE::sin(shift) }
+sub cos { CORE::cos(shift) }
+sub exp { CORE::exp(shift) }
+sub int { CORE::int(shift) }
+sub log { CORE::log(shift) }
+sub atan2 { CORE::atan2($_[0],$_[1]) }
+sub sqrt { CORE::sqrt(shift) }
sub tan { CORE::sin($_[0]) / CORE::cos($_[0]) }
#sub atan { atan2($_[0], 1); }
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.382 loncom/xml/lonxml.pm:1.383
--- loncom/xml/lonxml.pm:1.382 Wed Sep 14 15:20:23 2005
+++ loncom/xml/lonxml.pm Mon Sep 26 17:39:53 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.382 2005/09/14 19:20:23 albertel Exp $
+# $Id: lonxml.pm,v 1.383 2005/09/26 21:39:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -665,6 +665,9 @@
sub init_safespace {
my ($target,$safeeval,$safehole,$safeinit) = @_;
+ $safeeval->deny_only(':dangerous');
+ $safeeval->reval('use Math::Complex;');
+ $safeeval->permit_only(":default");
$safeeval->permit("entereval");
$safeeval->permit(":base_math");
$safeeval->permit("sort");
@@ -722,6 +725,36 @@
$safehole->wrap(\&Math::Cephes::stdtr ,$safeeval,'&stdtr' );
$safehole->wrap(\&Math::Cephes::stdtri,$safeeval,'&stdtri');
+ $safehole->wrap(\&Math::Cephes::Matrix::mat,$safeeval,'&mat');
+ $safehole->wrap(\&Math::Cephes::Matrix::new,$safeeval,
+ '&Math::Cephes::Matrix::new');
+ $safehole->wrap(\&Math::Cephes::Matrix::coef,$safeeval,
+ '&Math::Cephes::Matrix::coef');
+ $safehole->wrap(\&Math::Cephes::Matrix::clr,$safeeval,
+ '&Math::Cephes::Matrix::clr');
+ $safehole->wrap(\&Math::Cephes::Matrix::add,$safeeval,
+ '&Math::Cephes::Matrix::add');
+ $safehole->wrap(\&Math::Cephes::Matrix::sub,$safeeval,
+ '&Math::Cephes::Matrix::sub');
+ $safehole->wrap(\&Math::Cephes::Matrix::mul,$safeeval,
+ '&Math::Cephes::Matrix::mul');
+ $safehole->wrap(\&Math::Cephes::Matrix::div,$safeeval,
+ '&Math::Cephes::Matrix::div');
+ $safehole->wrap(\&Math::Cephes::Matrix::inv,$safeeval,
+ '&Math::Cephes::Matrix::inv');
+ $safehole->wrap(\&Math::Cephes::Matrix::transp,$safeeval,
+ '&Math::Cephes::Matrix::transp');
+ $safehole->wrap(\&Math::Cephes::Matrix::simq,$safeeval,
+ '&Math::Cephes::Matrix::simq');
+ $safehole->wrap(\&Math::Cephes::Matrix::mat_to_vec,$safeeval,
+ '&Math::Cephes::Matrix::mat_to_vec');
+ $safehole->wrap(\&Math::Cephes::Matrix::vec_to_mat,$safeeval,
+ '&Math::Cephes::Matrix::vec_to_mat');
+ $safehole->wrap(\&Math::Cephes::Matrix::check,$safeeval,
+ '&Math::Cephes::Matrix::check');
+ $safehole->wrap(\&Math::Cephes::Matrix::check,$safeeval,
+ '&Math::Cephes::Matrix::check');
+
# $safehole->wrap(\&Math::Cephes::new_fract,$safeeval,'&new_fract');
# $safehole->wrap(\&Math::Cephes::radd,$safeeval,'&radd');
# $safehole->wrap(\&Math::Cephes::rsub,$safeeval,'&rsub');
Index: loncom/startup.pl
diff -u loncom/startup.pl:1.21 loncom/startup.pl:1.22
--- loncom/startup.pl:1.21 Tue Jun 28 23:55:49 2005
+++ loncom/startup.pl Mon Sep 26 17:39:53 2005
@@ -24,7 +24,9 @@
use IO::Socket();
use LWP::UserAgent();
use Math::Cephes();
+use Math::Cephes::Matrix qw(mat);
use Math::Random();
+use Math::Complex;
use Opcode();
use POSIX qw(strftime);
use Safe();