[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [analitza/aucahuasi/analitzajit] /: Fix 'scalarproduct' operation in Analitza (must return a scalar
From: Percy_Camilo_Triveño_Aucahuasi <percy.camilo.ta () gmail ! com>
Date: 2014-08-03 4:51:15
Message-ID: E1XDnlL-0008Fy-JE () scm ! kde ! org
[Download RAW message or body]
Git commit 02c2a31a2a3f366c392b3484627a8a5bb508adb8 by Percy Camilo Triveño \
Aucahuasi. Committed on 03/08/2014 at 03:00.
Pushed by aucahuasi into branch 'aucahuasi/analitzajit'.
Fix 'scalarproduct' operation in Analitza (must return a scalar type and not a vector \
type)
M +3 -7 analitza/operations.cpp
M +1 -1 analitzajit/operationscompiler.cpp
M +2 -2 analitzajit/tests/analitzajittest.cpp
http://commits.kde.org/analitza/02c2a31a2a3f366c392b3484627a8a5bb508adb8
diff --git a/analitza/operations.cpp b/analitza/operations.cpp
index 759f087..3233921 100644
--- a/analitza/operations.cpp
+++ b/analitza/operations.cpp
@@ -960,9 +960,6 @@ QList<ExpressionType> Operations::infer(Operator::OperatorType \
op) ret << TypeTriplet(ExpressionType(ExpressionType::Value),
ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1),
ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1));
- ret << TypeTriplet(ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1),
- ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1),
- ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1)); ret << \
TypeTriplet(ExpressionType(ExpressionType::Value),
ExpressionType(ExpressionType::Matrix, \
ExpressionType(ExpressionType::Vector, ExpressionType(ExpressionType::Value), -2), \
-1),
ExpressionType(ExpressionType::Matrix, \
ExpressionType(ExpressionType::Vector, ExpressionType(ExpressionType::Value), -2), \
-1)); @@ -983,10 +980,9 @@ QList<ExpressionType> \
Operations::infer(Operator::OperatorType op) ExpressionType(ExpressionType::Bool));
break;
case Operator::scalarproduct:
- ret << TypeTriplet(
- ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1),
- ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1),
- ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1)); + ret << \
TypeTriplet(ExpressionType(ExpressionType::Vector, \
ExpressionType(ExpressionType::Value), -1), + \
ExpressionType(ExpressionType::Vector, ExpressionType(ExpressionType::Value), -1), \
+ ExpressionType(ExpressionType::Value)); break;
case Operator::power:
ret << TypeTriplet(ExpressionType(ExpressionType::Value), \
ExpressionType(ExpressionType::Value), \
ExpressionType(ExpressionType::Value));
diff --git a/analitzajit/operationscompiler.cpp b/analitzajit/operationscompiler.cpp
index 2609028..34d8879 100644
--- a/analitzajit/operationscompiler.cpp
+++ b/analitzajit/operationscompiler.cpp
@@ -561,7 +561,7 @@ llvm::Value * \
OperationsCompiler::compileVectorVectorOperation(llvm::BasicBlock* }
ret = sum;
- qDebug() << "WAAAAAAAAAAT" << \
((llvm::ConstantFP*)ret)->getValueAPF().convertToDouble(); +// qDebug() << \
"WAAAAAAAAAAT" << ((llvm::ConstantFP*)ret)->getValueAPF().convertToDouble(); }
return ret;
diff --git a/analitzajit/tests/analitzajittest.cpp \
b/analitzajit/tests/analitzajittest.cpp index 7a1fea5..91d0ccc 100644
--- a/analitzajit/tests/analitzajittest.cpp
+++ b/analitzajit/tests/analitzajittest.cpp
@@ -135,8 +135,8 @@ void AnalitzaJitTest::testCalculateUnaryRealLambda_data()
QTest::newRow("long piecewise otherwise 3") << "x->piecewise { x=1? x, x=2? x*x, \
x=3? 2*x, x=4? 44, x=9? 81, ? 42 }" << 3.0 << 6.0; QTest::newRow("long piecewise \
otherwise 4") << "x->piecewise { x=1? x, x=2? x*x, x=3? 2*x, x=4? 44, x=9? 81, ? 42 \
}" << 9.0 << 81.0; QTest::newRow("long piecewise otherwise 4") << "x->piecewise { \
x=1? x, x=2? x*x, x=3? 2*x, x=4? 44, x=9? 81, ? 42 }" << 10.0 << \
42.0;
-// QTest::newRow("dot product)") << "t->scalarproduct(vector{t, 5}, vector{2*t, \
-t})" << 7.0 << (98.0 - 35.0);
-// QTest::newRow("dot product)") << "t->scalarproduct(vector{1.0, 1.0}, vector{1.0, \
1.0})" << 7.0 << 2.0; + QTest::newRow("simple dot product)") << \
"t->scalarproduct(vector{1.0, 1.0}, vector{1.0, 1.0})" << 0.0 << 2.0; \
+ QTest::newRow("dot product)") << "t->scalarproduct(vector{t, 5}, vector{2*t, -t})" \
<< 7.0 << (98.0 - 35.0); }
void AnalitzaJitTest::testCalculateUnaryRealLambda()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic