MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: LatticeReduce problem

  • To: mathgroup at
  • Subject: [mg59035] Re: [mg59005] LatticeReduce problem
  • From: Andrzej Kozlowski <akoz at>
  • Date: Wed, 27 Jul 2005 01:25:12 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

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  
(who might for that reason not reply to your post;-))

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



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


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 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
  • Next by Date: Re: Problem with loading SuperWidgetPackage
  • Previous by thread: Re: LatticeReduce problem
  • Next by thread: Re: LatticeReduce problem