diff options
author | simon | 2008-08-19 17:16:29 +0000 |
---|---|---|
committer | simon | 2008-08-19 17:16:29 +0000 |
commit | 3aa1c9af066aba3d8c3ddc171994b42609479752 (patch) | |
tree | 9f1ceca9ac2eb5f7982af83ab70711775fa5c979 /src/matrixOperations | |
parent | 31e881dc749d8fc99028db3a09b565f392b382de (diff) | |
download | scilab2c-3aa1c9af066aba3d8c3ddc171994b42609479752.tar.gz scilab2c-3aa1c9af066aba3d8c3ddc171994b42609479752.tar.bz2 scilab2c-3aa1c9af066aba3d8c3ddc171994b42609479752.zip |
the test is not working yet
Diffstat (limited to 'src/matrixOperations')
-rw-r--r-- | src/matrixOperations/infiniteNorm/Makefile.am | 6 | ||||
-rw-r--r-- | src/matrixOperations/infiniteNorm/Makefile.in | 6 | ||||
-rw-r--r-- | src/matrixOperations/infiniteNorm/cinfnorma.c | 2 | ||||
-rw-r--r-- | src/matrixOperations/infiniteNorm/testMatrixInfiniteNorm.c | 148 |
4 files changed, 162 insertions, 0 deletions
diff --git a/src/matrixOperations/infiniteNorm/Makefile.am b/src/matrixOperations/infiniteNorm/Makefile.am index 809cd670..26d759be 100644 --- a/src/matrixOperations/infiniteNorm/Makefile.am +++ b/src/matrixOperations/infiniteNorm/Makefile.am @@ -33,6 +33,12 @@ check_PROGRAMS = testMatrixInfiniteNorm check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/lib/lapack/libscilapack.la \ + $(top_builddir)/lib/blas/libsciblas.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/auxiliaryFunctions/pythag/libPythag.la \ libMatrixInfiniteNorm.la check_INCLUDES = -I $(top_builddir)/type \ diff --git a/src/matrixOperations/infiniteNorm/Makefile.in b/src/matrixOperations/infiniteNorm/Makefile.in index 7fbf3c7d..242d2b4b 100644 --- a/src/matrixOperations/infiniteNorm/Makefile.in +++ b/src/matrixOperations/infiniteNorm/Makefile.in @@ -219,6 +219,12 @@ libMatrixInfiniteNorm_la_SOURCES = $(HEAD) \ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \ $(top_builddir)/type/libFloatComplex.la \ + $(top_builddir)/elementaryFunctions/sqrt/libSqrt.la \ + $(top_builddir)/lib/lapack/libscilapack.la \ + $(top_builddir)/lib/blas/libsciblas.la \ + $(top_builddir)/auxiliaryFunctions/abs/libAbs.la \ + $(top_builddir)/auxiliaryFunctions/sign/libSign.la \ + $(top_builddir)/auxiliaryFunctions/pythag/libPythag.la \ libMatrixInfiniteNorm.la check_INCLUDES = -I $(top_builddir)/type \ diff --git a/src/matrixOperations/infiniteNorm/cinfnorma.c b/src/matrixOperations/infiniteNorm/cinfnorma.c index e930d407..5d67aca9 100644 --- a/src/matrixOperations/infiniteNorm/cinfnorma.c +++ b/src/matrixOperations/infiniteNorm/cinfnorma.c @@ -32,3 +32,5 @@ float cinfnorma(floatComplex* in, int _iRows, int _iCols) return fltRef; } + + diff --git a/src/matrixOperations/infiniteNorm/testMatrixInfiniteNorm.c b/src/matrixOperations/infiniteNorm/testMatrixInfiniteNorm.c new file mode 100644 index 00000000..a4116f6c --- /dev/null +++ b/src/matrixOperations/infiniteNorm/testMatrixInfiniteNorm.c @@ -0,0 +1,148 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Allan SIMON + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include <assert.h> +#include <stdio.h> +#include "infiniteNorm.h" + + +#define LEADDIM 10 + +#define DMATRIX_IN {0.15869047446176410,0.80895681912079453,0.72621259605512023,0.18993748771026731,\ + 0.43964602379128337,0.37921421090140939,0.95195201179012656,0.59145097108557820,\ + 0.70597065938636661,0.62873698258772492,\ +0.62407150492072105,0.68317985069006681,0.70999773032963276,0.25839814636856318,\ + 0.65407369285821915,0.76687160786241293,0.71278580836951733,0.68067426700145006,\ + 0.70181696489453316,0.28785153012722731,\ +0.63760355720296502,0.03401931514963508,0.47457459988072515,0.09878737432882190,\ + 0.58781063789501786,0.60066213225945830,0.11923700617626309,0.07392961112782359,\ + 0.40879997471347451,0.3292048736475408,\ +0.42704886104911566,0.23805456422269344,0.9438692079856992,0.06199027225375175,\ + 0.60208318661898375,0.78567356057465076,0.50091631803661585,0.94336947053670883,\ + 0.06362213846296072,0.47192330472171307,\ +0.10716815060004592,0.94920115964487195,0.14596485672518611,0.04034968325868249,\ + 0.04535020282492042,0.73871155502274632,0.32900535268709064,0.12863306934013963,\ + 0.06573933875188231,0.33537696348503232,\ +0.23822965659201145,0.21827886346727610,0.07141010463237762,0.74001471605151892,\ + 0.20294443331658840,0.55442603398114443,0.48089468106627464,0.20190807711333036,\ + 0.53310041315853596,0.55530697200447321,\ +0.94629473658278584,0.61546878470107913,0.67337385797873139,0.61626600986346602,\ + 0.78442738251760602,0.99291495559737086,0.33036959776654840,0.19693034281954169,\ + 0.03315818728879094,0.11960808141157031,\ +0.45766852516680956,0.83135433867573738,0.65369247179478407,0.6583583448082209,\ + 0.26375361625105143,0.97574284672737122,0.63044753577560186,0.89286901615560055,\ + 0.31578356493264437,0.76139996573328972,\ +0.89644787041470408,0.77340125897899270,0.19968961318954825,0.25145971449092031,\ + 0.43832763982936740,0.37096222722902894,0.21171907847747207,0.46179189579561353,\ + 0.37858232436701655,0.47909884760156274,\ +0.44384705275297165,0.4244190966710448,0.60141251794993877,0.38433500844985247,\ + 0.86648589745163918,0.30322382133454084,0.44860231317579746,0.62512917164713144,\ + 0.46195234358310699,0.28169692959636450} + +#define DRESULT_OUT 6.44107022602111101 + +#define FMATRIX_IN {0.15869047446176410f,0.80895681912079453f,0.72621259605512023f,0.18993748771026731f,\ + 0.43964602379128337f,0.37921421090140939f,0.95195201179012656f,0.59145097108557820f,\ + 0.70597065938636661f,0.62873698258772492f,\ +0.62407150492072105f,0.68317985069006681f,0.70999773032963276f,0.25839814636856318f,\ + 0.65407369285821915f,0.76687160786241293f,0.71278580836951733f,0.68067426700145006f,\ + 0.70181696489453316f,0.28785153012722731f,\ +0.63760355720296502f,0.03401931514963508f,0.47457459988072515f,0.09878737432882190f,\ + 0.58781063789501786f,0.60066213225945830f,0.11923700617626309f,0.07392961112782359f,\ + 0.40879997471347451f,0.3292048736475408f,\ +0.42704886104911566f,0.23805456422269344f,0.9438692079856992f,0.06199027225375175f,\ + 0.60208318661898375f,0.78567356057465076f,0.50091631803661585f,0.94336947053670883f,\ + 0.06362213846296072f,0.47192330472171307f,\ +0.10716815060004592f,0.94920115964487195f,0.14596485672518611f,0.04034968325868249f,\ + 0.04535020282492042f,0.73871155502274632f,0.32900535268709064f,0.12863306934013963f,\ + 0.06573933875188231f,0.33537696348503232f,\ +0.23822965659201145f,0.21827886346727610f,0.07141010463237762f,0.74001471605151892f,\ + 0.20294443331658840f,0.55442603398114443f,0.48089468106627464f,0.20190807711333036f,\ + 0.53310041315853596f,0.55530697200447321f,\ +0.94629473658278584f,0.61546878470107913f,0.67337385797873139f,0.61626600986346602f,\ + 0.78442738251760602f,0.99291495559737086f,0.33036959776654840f,0.19693034281954169f,\ + 0.03315818728879094f,0.11960808141157031f,\ +0.45766852516680956f,0.83135433867573738f,0.65369247179478407f,0.6583583448082209f,\ + 0.26375361625105143f,0.97574284672737122f,0.63044753577560186f,0.89286901615560055f,\ + 0.31578356493264437f,0.76139996573328972f,\ +0.89644787041470408f,0.77340125897899270f,0.19968961318954825f,0.25145971449092031f,\ + 0.43832763982936740f,0.37096222722902894f,0.21171907847747207f,0.46179189579561353f,\ + 0.37858232436701655f,0.47909884760156274f,\ +0.44384705275297165f,0.4244190966710448f,0.60141251794993877f,0.38433500844985247f,\ + 0.86648589745163918f,0.30322382133454084f,0.44860231317579746f,0.62512917164713144f,\ + 0.46195234358310699f,0.28169692959636450f} + +#define FRESULT_OUT 6.44107022602111101f + +static void sinfnormaTest(void) { + + float in[] = FMATRIX_IN ; + + float out = 0; + + float result = FRESULT_OUT ; + + out = sinfnorma ( in , LEADDIM , LEADDIM ); + + printf ( "\t\t out : %e\tresult : %e\tassert : %e \n" , out , result , fabs ( out - result ) / fabs( out) ) ; + assert ( fabs ( out - result ) / fabs( out) < 1e-6 ) ; + + + +} + +static void dinfnormaTest(void) { + + double in[] = DMATRIX_IN ; + + double out = 0; + + double result = DRESULT_OUT ; + + out = dinfnorma ( in , LEADDIM , LEADDIM ); + + printf ( "\t\t out : %e\tresult : %e\tassert : %e \n" , out , result , fabs ( out - result ) / fabs( out) ) ; + assert ( fabs ( out - result ) / fabs( out) < 1e-14 ) ; + + + +} + + +static int testInfiniteNorm(void) { + + printf("\n>>>> Matrix Exponential Tests\n"); + printf("\t>>>> Matrix Double Realt Tests\n"); + dinfnormaTest(); + + printf("\n\n\t>>>> Matrix Float Realt Tests\n"); + sinfnormaTest(); + + /* printf("\n\n\n"); + printf("\t>>>> Matrix Float Complex Tests\n"); + cexpmaTest(); + + printf("\n\n\n"); + printf("\t>>>> Matrix Double Complex Tests\n"); + zexpmaTest();*/ + + return 0; +} + + + +int main(void) { + assert(testInfiniteNorm() == 0); + return 0; +} + + |