Sergey.Bochkanov wrote:
No, in the current version you have to do it yourself. But I recommend you to use functions from ablas.cpp unit, which provides better optimized BLAS. I also recommend to switch to 3.0 branch of ALGLIB because a) it is mostly compatible with 2.x you seems to use, and b) 2.x branch will not be updated anymore.
Actually all these BLAS functions are intended to be used internally, when you want to take part of matrix A, part of B, multiply them and store somewhere in the middle of C. Maybe in the next release which scheduled for September I will implement "user-friendly" BLAS.
ok, thanks for your fast response :)
is the 3.0 branch with rc1 stable and tested for the pca ? for my future use there would be too much input to the pca (probably 400-500 2D polygons as current guess, each one has to be "aligned" on the PC axes) so this is important ;)
yeah, sorry i forgot, i'm currently using 2.6.0 version, but as i just started, it should be not that big deal to change to 3.0 :) and the pca with its subsequent dependencies are the only source files i need from the alglib
as i have a (0, 110, 0, 1) bounded array with the mean data and a (0, 1, 0, 1) bounded array with the eigenvectors, i would take the whole matrices for getting the final transformed data :)
good to hear from possible more user-friendly BLAS routines for september as this is good within my project scope :D
Sergey.Bochkanov wrote:
Hmm, I don't get it. Why do you talking about half of points? If you have 220 points, you should have a[0..219,0..1]. Where did you get from 111? :)
sorry for that, i should start my day with coffee like normal people instead of surfing the web :D
as there are just 111 points, everything is fine. i confused myself with the 222 effective values for storing 111 2D points :lol:
Sergey.Bochkanov wrote:
As for your code, there are several errors:
* you should allocate C - it doesn't allocated automatically by BLAS functions
* you should set beta to 0.0
* you should set ci1 to ai1, ci2 to ai2 and so on. Size of C is same as size of A.
ok, for debugging it was too early to this morning ;)
i just finished transforming into pca space but my points are mirrored vertically, where does this come from ?
the polygon which the points form looks good, maximum variance on x axis and second max variance on y axis are right too
Code:
ap::real_2d_array a = _mean_adjusted_input_data;
int ai1 = _mean_adjusted_input_data.getlowbound(1);
int ai2 = _mean_adjusted_input_data.gethighbound(1);
int aj1 = _mean_adjusted_input_data.getlowbound(0);
int aj2 = _mean_adjusted_input_data.gethighbound(0);
bool transa = false;
ap::real_2d_array b = _eigenvectors;
int bi1 = _eigenvectors.getlowbound(1);
int bi2 = _eigenvectors.gethighbound(1);
int bj1 = _eigenvectors.getlowbound(0);
int bj2 = _eigenvectors.gethighbound(0);
bool transb = false;
double alpha = 1.0;
ap::real_2d_array c = ap::real_2d_array();
c.setbounds(ai1, ai2, aj1, aj2);
double beta = 0.0;
ap::real_1d_array work;
work.setbounds(1, ap::maxint(ai2, aj2));
matrixmatrixmultiply(a, ai1, ai2, aj1, aj2, transa, b, bi1, bi2, bj1, bj2, transb, alpha, c, ai1, ai2, aj1, aj2, beta, work);
_final_data = c;
double * transformedVectorData = new double[1];
ap::raw_vector<double> transformedVector = ap::raw_vector<double>(transformedVectorData, 1, 1);
QPolygonF transformedPolygon = QPolygonF();
QPointF point;
for (int i = 0; i < c.gethighbound(1); i++)
{
transformedVector = c.getrow(i, c.getlowbound(0), c.gethighbound(0));
transformedVectorData = transformedVector.GetData();
if (NUMBER_OF_AXES == transformedVector.GetLength())
{
point = QPointF(transformedVectorData[0], transformedVectorData[1]);
transformedPolygon.append(point);
}
}