ALGLIB forum
It is currently Tue Jul 16, 2024 4:07 am

All times are UTC

Forum rules

1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Problem with Cholesky for SPD
PostPosted: Thu Nov 15, 2012 9:31 pm 

Joined: Thu Nov 15, 2012 9:10 pm
Posts: 1
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

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 10 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group