From 4b011f71f72ae7f60d78434985c7d1f9c2c57972 Mon Sep 17 00:00:00 2001 From: Sylvain GENIN Date: Thu, 10 Jul 2014 15:23:32 +0200 Subject: [PATCH] fix srkf a transpose function is loophole used by 5.5 for transpose an element l=list([1 2 3], [1;2;3], [4 5 6]) [a,b,c] = l(1:3)' test_run("signal_processing","srkf",["no_check_error_output" ]) Change-Id: I2cc0946cc0af669b71b2da2ec169a1d789dcb0ff --- scilab/modules/ast/src/cpp/ast/runvisitor.cpp | 8 ++++++++ scilab/modules/signal_processing/macros/srkf.sci | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scilab/modules/ast/src/cpp/ast/runvisitor.cpp b/scilab/modules/ast/src/cpp/ast/runvisitor.cpp index 8182e31..92a2a4b 100644 --- a/scilab/modules/ast/src/cpp/ast/runvisitor.cpp +++ b/scilab/modules/ast/src/cpp/ast/runvisitor.cpp @@ -903,6 +903,14 @@ void RunVisitorT::visitprivate(const TransposeExp &e) { e.exp_get().accept(*this); + if (result_getSize() != 1) + { + result_clear(); + wchar_t szError[bsiz]; + os_swprintf(szError, bsiz, _W("%ls: Can not transpose multiple elements.\n").c_str(), L"Transpose"); + throw ScilabError(szError, 999, e.location_get()); + } + InternalType * pValue = result_get(); InternalType * pReturn = NULL; const bool bConjug = e.conjugate_get() == TransposeExp::_Conjugate_; diff --git a/scilab/modules/signal_processing/macros/srkf.sci b/scilab/modules/signal_processing/macros/srkf.sci index 7f6792c..5931baa 100644 --- a/scilab/modules/signal_processing/macros/srkf.sci +++ b/scilab/modules/signal_processing/macros/srkf.sci @@ -29,7 +29,8 @@ function [x1,p1]=srkf(y,x0,p0,f,h,q,r) g=[0*q,chol(q)']; mat=[h*p0,j;f*p0,g]; - [q,tmat]=qr(mat')'; + [q,tmat]=qr(mat'); + tmat=tmat'; p1=tmat(p+1:p+n,p+1:p+n); k=tmat(p+1:p+n,1:p); re=tmat(1:p,1:p); -- 1.7.9.5