Opened 11 years ago

Closed 8 years ago

#317 closed defect (fixed)

WCPS1.5_WCPS and complex numbers

Reported by: Piero Campalani Owned by: Alex Dumitru
Priority: minor Milestone: 9.3
Component: petascope Version: development
Keywords: wcps complex numbers Cc:
Complexity: Hard

Description

WCPS does not seem to support complex operations with numbers.
Casting is not implemented yet in the RasQL (QL guide, p.53 Restrictions), and although WCPS complexConstant can be defined (with static numbers):

complexConstant returns[String value]
	: LPAREN re1=FLOATCONSTANT COMMA im1=FLOATCONSTANT RPAREN { $value = new String($re1.text +"+i"+$im1.text); }
	;

they don't seem to work:

for c in (mr)
return (0.1, 0.1)

Error: Invalid coverage Expression, next node: complexConstant

Looking at petascope.wcps.grammar.wcps.g, complex expressions seems allowed only inside a USING clause:

03 06 2009 andreia	Complex expressions introduced in the "using" clause of general condense operations

but this neither seem to work:

for c in (mr)
return encode(
  coverage complexNumber
  over $x x (0:0),
       $y y (0:0)
  values condense +
      over $x x (0:0),
           $y y (0:0)
      using (0.1, 0.1),
"csv")

Error: Invalid coverage Expression, next node: condense - failed to match SubsetOperation: condense

This might deserve some effort at some point.

Change History (4)

comment:1 by Dimitar Misev, 8 years ago

Complexity: Very Hard
Owner: changed from abeccati to Alex Dumitru
Status: newassigned

comment:2 by Bang Pham Huu, 8 years ago

Complexity: Very HardHard
Summary: WCPS and complex numbersWCPS1.5_WCPS and complex numbers

Piero,

Your second example works in WCPS1.5, but first example does not work. I've opened a ticket for this problem http://rasdaman.org/ticket/1261.

i.e, query will be translated to Rasql like:

http://localhost:8088/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=
for c in (mr) return encode(coverage complexNumber 
over $x x (0:1),$y y (0:1) values 
condense over $x x (0:1),$y y (0:1) 
using (0.1, 0.1),"csv")&wcpsVersion=2.0

to Rasql:

SELECT encode(
MARRAY x in [0:1,209:210] VALUES 
CONDENSE + 
OVER x in [0:1,209:210] 
USING complex(0.1, 0.1), "csv" ) 
FROM mr AS c

In WCPS1.5 grammar and WCPS1.0 document, ComplexConstant belonged to "numericScalarExpr", then it can also work like this, beside "using" clause in condenser.

for c in (mr) return avg(c) + avg(c) + 1 + (0.1, 0.1)

but returns error

ows:ExceptionText>java.lang.ClassCastException : 
petascope.wcps2.translator.ComplexNumberConstant cannot be cast to
petascope.wcps2.translator.CoverageExpression</ows:ExceptionText>

then in WCPS1.5, this ticket will need to fix this problem with Complex Numbers in Numerical Scalar Expression.

comment:3 by Bang Pham Huu, 8 years ago

Milestone: Future9.3
Version: 8.3development

This query works in WCPS 1.5

for c in (mr) return encode(coverage complexNumber 
over $x x (0:1),$y y (0:1) values 
condense +
over $x x (0:1),$y y (0:1) 
using (0.1, 0.1),"csv")&wcpsVersion=2.0

and this works also

for c in (mr) return (0.1, 0.1)

but it has error with Rasql support complex number http://rasdaman.org/ticket/794

Close ticket here as it was fixed in WCPS 1.5.

comment:4 by Bang Pham Huu, 8 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.