RE: Different Methods inside one package
- To: mathgroup at smc.vnet.net
- Subject: [mg33726] RE: [mg33715] Different Methods inside one package
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Wed, 10 Apr 2002 00:49:07 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
> -----Original Message----- > From: J. Guillermo Sanchez [mailto:guillerm at usal.es] To: mathgroup at smc.vnet.net > Sent: Tuesday, April 09, 2002 7:03 AM > Subject: [mg33726] [mg33715] [mg33715] Different Methods inside one package > > > > (* Dear friends, I wish build a package where the user, as one option, > can be choose one of three methods of evaluation, i.e: > Automatic, LT or > EV. Some thing like this silly example *) > > BeginPackage["test`test`"] > > methodTest::usage="methodTest. This is an example" > > Options[methodTest]={Method\[Rule]Automatic}; > > Begin["`Private`"] > > methodTest[matrixA_, incond_, opts___]:= > If[Automatic == Method/.{opts}/.Options[methodTest], > Module[{a, b, r},(a = matrixA; b = incond; r = a b)]] > > methodTest[matrixA_, incond_, opts___]:= > If[LT == Method/.{opts}/.Options[methodTest], > Module[{a, b, r},(a = matrixA; b = incond; r = a /b)]] > > methodTest[matrixA_, incond_, opts___]:= > If[EV == Method/.{opts}/.Options[methodTest], > Module[{a, b, r},(a = matrixA; b = incond; r = a + b)]] > > End[] > > Protect[methodTest]; > > EndPackage[] > > list1 ={{a11, a12 },{a21,a22}} > > methodTest[list1,list2] > > methodTest[list1,list2, Method\[Rule]EV] > > methodTest[list1,list2, Method\[Rule]LT] > > > (*How can I get that this example work?*) > Guillermo,