Problem with Cholesky for SPD
Page 1 of 1

Author:  ULAANALISIS [ Thu Nov 15, 2012 9:31 pm ]
Post subject:  Problem with Cholesky for SPD

Hello! first of all were are not sure how to compile using Alglib, here is the code:

#include "alglibinternal.h"
#include "linalg.h"
#include "ap.h"
#include <fstream>
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include "stdafx.h"

using namespace alglib;
using namespace std;

int main(){

   ifstream archivo;"salida.txt");
   int n,m,NM,N,M;
   string valor,ns,ms,NMS;
   getline(archivo,valor,' ');
   getline(archivo,valor,' ');
   double matrix[N][M];
        double *array;
        real_1d_array b;
        array=new double(N*M);

   for(int i=0;i<N;i++){
      for(int j=0;j<M;j++){
      getline(archivo,ns,' ');
      getline(archivo,ms,' ');
   for(int i=0,l=0;i<N;i++,l++){
      for(int j=0;j<M;j++){

   real_1d_array X;
        real_2d_array A; //<<<<<------ [color=#FF0000]PROBLEM[/color]
   ae_int_t max_fila(N);
   ae_int_t max_columna(M);
   ae_int_t info;
   double r1,rinf;
   //densesolverreport& rep; [color=#0000FF]spdmatrixcholesky need this data type but it doesn't work[/color]
   for(int i=0; i<N;i++){
   for(int i=1,l=0;i<10;i++,l++){
      for(int j=1;j<10;j++){
         cout<< A(i,j)<<"\t";
   //spdmatrixcholesky(A, max_fila, false,b,info,rep,X);[color=#0000FF] Is this the right way to use this function[/color]?
        delete [] array;
   return 0;


The compilation line throw nothing, but when the program is executed it's aborted, then we runned with ddd, it shows us that the problem is when A (real_2d_array) was declared why is this happening? We use this lines to compile:

g++ -g ap.cpp  bcsstk01.cpp

The weird thing is that X (real_1d_array) was declared normally.

We are students of a signature named Numerical Analysis, we are using your library to make a project. The matrices we are using are Symetric Positive definite.

PD: i only see that you have Cholesky and Doolitte (the normal LU factorization) but i was wondering if there is a method to solve using Crout (for tridiagonal matrices)

PDD: sorry for our bad english

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group