From e503945c666dc28f1a806ba1a2deaa587a836200 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 30 Dec 2010 18:07:39 +0000 Subject: cond --- lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | 22 ++++++++++++++++++++++ lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h | 3 +++ lib/Numeric/LinearAlgebra/Tests.hs | 10 +++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) (limited to 'lib/Numeric/LinearAlgebra') diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c index ae437d2..f4ae0f6 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c @@ -1267,3 +1267,25 @@ int stepD(DVEC(x),DVEC(y)) { OK } +//////////////////// cond ///////////////////////// + +int condF(FVEC(x),FVEC(y),FVEC(lt),FVEC(eq),FVEC(gt),FVEC(r)) { + REQUIRES(xn==yn && xn==ltn && xn==eqn && xn==gtn && xn==rn ,BAD_SIZE); + DEBUGMSG("condF") + int k; + for(k=0;kyp[k]?gtp[k]:eqp[k]); + } + OK +} + +int condD(DVEC(x),DVEC(y),DVEC(lt),DVEC(eq),DVEC(gt),DVEC(r)) { + REQUIRES(xn==yn && xn==ltn && xn==eqn && xn==gtn && xn==rn ,BAD_SIZE); + DEBUGMSG("condD") + int k; + for(k=0;kyp[k]?gtp[k]:eqp[k]); + } + OK +} + diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h index 6207a59..9526583 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h @@ -90,6 +90,9 @@ int conjugateC(KCVEC(x),CVEC(t)); int stepF(FVEC(x),FVEC(y)); int stepD(DVEC(x),DVEC(y)); +int condF(FVEC(x),FVEC(y),FVEC(lt),FVEC(eq),FVEC(gt),FVEC(r)); +int condD(DVEC(x),DVEC(y),DVEC(lt),DVEC(eq),DVEC(gt),DVEC(r)); + int svd_l_R(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); int svd_l_Rdd(KDMAT(x),DMAT(u),DVEC(s),DMAT(v)); int svd_l_C(KCMAT(a),CMAT(u),DVEC(s),CMAT(v)); diff --git a/lib/Numeric/LinearAlgebra/Tests.hs b/lib/Numeric/LinearAlgebra/Tests.hs index 181cfbf..76eaaae 100644 --- a/lib/Numeric/LinearAlgebra/Tests.hs +++ b/lib/Numeric/LinearAlgebra/Tests.hs @@ -369,7 +369,14 @@ findAssocTest = utest "findAssoc" ok where ok = m1 == m2 m1 = assoc (6,6) 7 $ zip (find (>0) (ident 5 :: Matrix Float)) [10 ..] :: Matrix Double - m2 = diagRect 7 (fromList[10..14]) 6 6 :: Matrix Double + m2 = diagRect 7 (fromList[10..14]) 6 6 + +--------------------------------------------------------------------- + +condTest = utest "cond" ok + where + ok = step v * v == cond v 0 0 0 v + v = fromList [-7 .. 7 ] :: Vector Float --------------------------------------------------------------------- @@ -542,6 +549,7 @@ runTests n = do , chainTest , succTest , findAssocTest + , condTest ] return () -- cgit v1.2.3