Re: locally changing Options
- To: mathgroup at smc.vnet.net
- Subject: [mg108293] Re: [mg108224] locally changing Options
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 12 Mar 2010 07:14:38 -0500 (EST)
- References: <5310030.1268308256178.JavaMail.root@n11>
An interesting question. I don't know of a good way to use Block on an Option value. Maybe someone will come up with a solution. I assume that within foo you are using RowReduce a number of times so you don't want to write the specific option value each time. Why not define your own local version of RowReduce for the foo routine? foo[x_]:= Module[{rowReduce} rowReduce[mat_]:= RowReduce[mat, Method -> "OneStepRowReduction"]; ...; rowReduce[x]] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: hemmecke [mailto:hemmecke at gmail.com] In a function I'd like to temporarily say foo[x_]:=Module[{...}, ... SetOptions[RowReduce, Method->OneStepRowReduction]; ... ] without affecting the global setting for RowReduce when I call foo. My experiments wrapping the SetOptions with a Block structure were not fruitful so far. The only thing I can think of is something of the form method = Options[RowReduce, Method]; SetOptions[RowReduce, Method->OneStepRowReduction]; ... do something ... SetOptions[RowReduce,method] But that looks ugly. Any suggestions with built-in Mathematica features to achieve this kind of locality. Ralf