       Re: LatticeReduce problem

• To: mathgroup at smc.vnet.net
• Subject: [mg59035] Re: [mg59005] LatticeReduce problem
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Wed, 27 Jul 2005 01:25:12 -0400 (EDT)
• References: <200507260803.EAA00441@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```There are quite many problems here. Let me start by observing that
using Return in your way makes no sense in Mathematica at all, it
simply does nothing but irritate some FORTRAN-hating WRI employees

A more serious problem is your function dln will complain when called
with symbolic coefficients but that is what will happen when you use
NMinimize, since NMinimize evaluates its arguments. Another problem
is that in spite of the constraint  NMinimize will attempt to compute
dln for real values of x1,x2,x3 and x4 and LatticeReduce is not
defined non-rational vectors. So I have re-written dln in the form:

dln[{x__?NumericQ}, { y__?NumericQ}] :=
Norm[ LatticeReduce[{IntegerPart /@ {x}, IntegerPart /@ {y}}]]

We also will fact the problem of dealing with the zero vector since

LatticeReduce[{{0,0},{0,0}}]

{}

I'll deal with this by redefining Norm so that the NOrm of the empty
set is a large number:

Unprotect[Norm];Norm[{}]=10^23;Protect[Norm];

Finally, the method NelderMead does not seem to work well in this
case, but if we run the code with the default Method setting we now get:

NMinimize[{dln[{x1, x2}, {y1, y2}],
MatrixRank[{{x1, x2}, {y1, y2}}] == 2,
(x1 | x2 | y1 | y2) â?? Integers}, {x1, x2, y1, y2}]

{1., {x1 -> 0, x2 -> -1, y1 -> 1, y2 -> -2}}

Andrzej Kozlowski

On 26 Jul 2005, at 10:03, dto_mba at skynet.be wrote:

> dln[x_, y_] := Module[{lr},
>      lr = LatticeReduce[{x, y}];
>      Return[Norm[lr]]
>      ]
> NMinimize[{dln[{x1, x2}, {y1, y2}],
>      MatrixRank[{{x1, x2}, {y1, y2}}] â?? 2, {x1, x2, y1, y2} \
> [Element]
>       Integers}, {x1, x2, y1, y2}, Method -> NelderMead]
>
> The message I get is : LatticeReduce::latm:
> Matrix contains entry that is not rational.
>
> Apparently x and y have no value when it comes to LatticeReduce.
>
> Who can help me ?
>
> Best,
>
> Theodor Schlickmann
>
>
>
>
>
>

```

• Prev by Date: "Substract one and add one" algorithm