public static String getOpcode()

in src/main/java/org/apache/sysds/lops/PartialAggregate.java [244:381]


	public static String getOpcode(AggOp op, Direction dir)
	{
		switch( op )
		{
			case SUM: {
				// instructions that use kahanSum are similar to ua+,uar+,uac+
				// except that they also produce correction values along with partial
				// sums.
				if( dir == Direction.RowCol )
					return Opcodes.UAKP.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARKP.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACKP.toString();
				break;
			}

			case SUM_SQ: {
				if( dir == Direction.RowCol )
					return Opcodes.UASQKP.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARSQKP.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACSQKP.toString();
				break;
			}

			case MEAN: {
				if( dir == Direction.RowCol )
					return Opcodes.UAMEAN.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARMEAN.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACMEAN.toString();
				break;
			}

			case VAR: {
				if( dir == Direction.RowCol )
					return Opcodes.UAVAR.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARVAR.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACVAR.toString();
				break;
			}

			case PROD: {
				switch( dir ) {
					case RowCol: return Opcodes.UAM.toString();
					case Row:    return Opcodes.UARM.toString();
					case Col:    return Opcodes.UACM.toString();
				}
			}
			
			case SUM_PROD: {
				switch( dir ) {
					case RowCol: return "ua+*";
					case Row:    return "uar+*";
					case Col:    return "uac+*";
				}
			}
			
			case MAX: {
				if( dir == Direction.RowCol )
					return Opcodes.UAMAX.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARMAX.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACMAX.toString();
				break;
			}
			
			case MIN: {
				if( dir == Direction.RowCol )
					return Opcodes.UAMIN.toString();
				else if( dir == Direction.Row )
					return Opcodes.UARMIN.toString();
				else if( dir == Direction.Col )
					return Opcodes.UACMIN.toString();
				break;
			}
			
			case MAXINDEX:{
				if( dir == Direction.Row )
					return Opcodes.UARIMAX.toString();
				break;
			}
			
			case MININDEX: {
				if( dir == Direction.Row )
					return Opcodes.UARIMIN.toString();
				break;
			}
			
			case TRACE: {
				if( dir == Direction.RowCol )
					return Opcodes.UAKTRACE.toString();
				break;
			}

			case COUNT_DISTINCT: {
				switch (dir) {
					case RowCol: return Opcodes.UACD.toString();
					case Row: return Opcodes.UACDR.toString();
					case Col: return Opcodes.UACDAPC.toString();
					default:
						throw new LopsException("PartialAggregate.getOpcode() - "
								+ "Unknown aggregate direction: " + dir);
				}
			}

			case COUNT_DISTINCT_APPROX: {
				switch (dir) {
					case RowCol: return Opcodes.UACDAP.toString();
					case Row: return Opcodes.UACDAPR.toString();
					case Col: return Opcodes.UACDAPC.toString();
					default:
						throw new LopsException("PartialAggregate.getOpcode() - "
								+ "Unknown aggregate direction: " + dir);
				}
			}

			case UNIQUE: {
				switch (dir) {
					case RowCol: return Opcodes.UNIQUE.toString();
					case Row: return Opcodes.UNIQUER.toString();
					case Col: return Opcodes.UNIQUEC.toString();
					default:
						throw new LopsException("PartialAggregate.getOpcode() - "
								+ "Unknown aggregate direction: " + dir);
				}
			}
		}
		
		//should never come here for normal compilation
		throw new UnsupportedOperationException("Instruction is not defined for PartialAggregate operation " + op);
	}