By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,617 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,617 IT Pros & Developers. It's quick & easy.

Error in A SVD Program - Help Required

P: n/a
I've written the following program for what we discussed and I get a

Exception in thread "main" javax.vecmath.MismatchedSizeException:
GMatrix.SVD: d
imension mismatch with V matrix
at javax.vecmath.GMatrix.SVD(GMatrix.java:1521)
at SVDTest.main(SVDTest.java:41)

Can't see why myself? Any ideas?
import javax.vecmath.* ;

public class SVDTest {
public static void main (String[] args) {
GMatrix u,v,w ;

double[] aInput = { 0,1,0,1,0,0,0,0,0,-58,0,
0,0,0,0,0,1,0,1,0,-201,0,

0,1,1,1,0,0,0,0,0,-53,-53,
0,0,0,0,0,1,1,1,0,-52,-52,

0,0,0,1,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1,0,0,0,

0,0,1,1,0,0,0,0,0,0,-156,
0,0,0,0,0,0,1,1,0,0,-44,

1,0,0,1,0,0,0,0,-263,0,0,
0,0,0,0,1,0,0,1,-193,0,0,

1,0,1,1,0,0,0,0,-259,0,-259,
0,0,0,0,1,0,1,1,-45,0,-45,
} ;

GMatrix a = new GMatrix(12,11, aInput) ;

u = new GMatrix(12,12) ;
v = new GMatrix(11,11) ;
w = new GMatrix(12,11) ;

a.SVD(u,v,w) ;

GVector alpha = new GVector(11) ;
double[] bInput = {58.,201.,53.,52.,159.,181.,156.,44.,263.,193.,259 .,45.} ;
GVector b = new GVector(bInput) ;

alpha.SVDBackSolve(u,v,w,b) ;

}


}
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
>
GVector alpha = new GVector(11) ;
double[] bInput = {58.,201.,53.,52.,159.,181.,156.,44.,263.,193.,259 .,45.} ;
GVector b = new GVector(bInput) ;

alpha.SVDBackSolve(u,v,w,b) ;

}


}


bInput is an array with 12 elements, but GVector accepts only 11 elements...
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.