Re: Compile message suppression
- To: mathgroup at smc.vnet.net
- Subject: [mg39334] Re: [mg39294] Compile message suppression
- From: Omega Consulting <info at omegaconsultinggroup.com>
- Date: Tue, 11 Feb 2003 04:47:16 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 03:52 AM 2/9/2003, Y.A.Tesiram wrote:
>Dear Mathgroup,
>
>I have a function defined as
>
>f = Compile[{{arg1, _Real, 2}, {arg2, _Real}, {arg3, _Real}, Module[ {},
>expr]]
>
>and I want to use a a non-Real assignment to arg2 called x, Mathematica
>correctly returns a warning message saying that assignment x should be a
>real, but it still returns the correct symbolic expression for f. How do I
>turn the message off or better still how can I handle this sort of
>assignment a little more thoroughly inside Compile?
>
>Thanks
>Yas
You can turn the message off with the Off command.
Off[CompiledFunction::"cfsa"]
However, there is more than one type of error that can occur. A better
method might be to error check with function overloading.
If the arguments are of the right type, use the compiled function.
RealQ[x_] := MatchQ[x, _Real]
f2[arg1_/;MatrixQ[arg1, RealQ], arg2_Real, arg3_Real] :=
f[arg1, arg2, arg3]
Otherwise, use the uncompiled function.
f2[arg1_, arg2_, arg3_] :=
expr
--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"
http://omegaconsultinggroup.com