JDK-6349553 : Badly need operator overloading or at least dedicated vector/matrix operators
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2005-11-14
  • Updated: 2010-05-08
  • Resolved: 2006-11-14
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
I do alot of number crunching in java but writing even the simplest vector equations is torturous. Java badly needs either operator overloading as done in the 3D vector classes available for C++ or dedicated operators for matrices and vectors (there's still plenty of unused symbols on my keyboard!) I know game developers would kill for this. Right now my only options are C++ which is painful or fortran which is nauseating.
We also need an exponentiation operator.
Art.

JUSTIFICATION :
Anything that uses vector math and linear algebra is much much easier with operators rather than nested nested nested functions. Nested functions are hell to troubleshoot.
You'd attract more engineering software developers and, more importantly, alot more game developers.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
double[] w = { ... }
double[] x = { ... }
double[] y = { ... }
double[] z = { ... }
double[][] A = { ... }
double[][] B = { ... }
double[][] C = { ... }
double[][] D = { ... }
double g = ...
double h = ...
y = A * y -g^3*(B*D+C') *z - w
ACTUAL -
y = vectorSubtract(vectorAdd(vectorMatrixMultiply(A,y), scalarVectorMultiply(Math.pow(g,3), vectorMultiply(matrixAdd(matrixMultiply(B,D),matrixTranspose(C))),z)),scalarVectorMultiply(h,w))

---------- BEGIN SOURCE ----------
This is a request for a feature. Not a bug report.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Nesting functions as detailed above.