Functions

oct_get_prpi.cpp File Reference

#include <oct.h>
Include dependency graph for oct_get_prpi.cpp:

Go to the source code of this file.

Functions

double * oct_GetPr (octave_value arg)
double * oct_GetPi (octave_value arg)
double * oct_GetSparsePr (octave_value arg)
double * oct_GetSparsePi (octave_value arg)
int * oct_GetSparseIr (octave_value arg)
int * oct_GetSparseJc (octave_value arg)

Function Documentation

double* oct_GetPi ( octave_value  arg  ) 

Definition at line 23 of file oct_get_prpi.cpp.

                                    {
    double *pi;
    int i, j;
 
    if (arg.is_real_type()) {
        pi = (double *) malloc(arg.rows() * arg.columns() * sizeof(double));
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                *(pi + i + (j * arg.rows())) = 0;
    } else {
        pi = (double *) malloc(arg.rows() * arg.columns() * sizeof(double));
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                *(pi + i + (j * arg.rows())) =
                imag((arg.complex_matrix_value())(i, j));
    }
 
    return pi;
}

Here is the caller graph for this function:

double* oct_GetPr ( octave_value  arg  ) 

Definition at line 3 of file oct_get_prpi.cpp.

                                   {
    double *pr;
    int i, j;

    if (arg.is_real_type()) {
        pr = (double *) malloc(arg.rows() * arg.columns() * sizeof(double));
        for ( j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                *(pr + i + (j * arg.rows())) = (arg.matrix_value())(i, j);
    } else {
        pr = (double *) malloc(arg.rows() * arg.columns() * sizeof(double));
        for (j = 0; j<arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                *(pr + i + (j * arg.rows())) =
                real((arg.complex_matrix_value())(i, j));
    }

    return pr;
}

Here is the caller graph for this function:

int* oct_GetSparseIr ( octave_value  arg  ) 

Definition at line 129 of file oct_get_prpi.cpp.

                                       {
    int    *Ir;
    int    i, j;
    int    count;
    int    index;

    if (arg.is_real_type()) {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) count++;
    
        Ir = (int *) malloc(count * sizeof(int));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) {
                    *(Ir + index) = i;
                    index++;
                }
    } else {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0) )
                    count++;
        
        Ir = (int *) malloc(count * sizeof(int));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0)) {
                    *(Ir + index) = i;
                    index++;
                }
              
    }

    return Ir;
}

Here is the caller graph for this function:

int* oct_GetSparseJc ( octave_value  arg  ) 

Definition at line 172 of file oct_get_prpi.cpp.

                                       {
    int    *Jc;
    int    i, j;
    int    count;

    Jc = (int *) malloc(arg.columns() * sizeof(int) + 1);

    if (arg.is_real_type()) {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
          for (i = 0; i < arg.rows(); i++)
             if ((arg.matrix_value())(i, j) != 0 ) count++;
        *(Jc + arg.columns()) = count;

        count = 0;
        for (j = 0; j < arg.columns(); j++) {
            *(Jc + j) = count;
            for (i = 0; i < arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) count++;
        }
    } else {
        count = 0;
        for (j = 0;j<arg.columns();j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i,j)) != 0) || 
                    (imag((arg.complex_matrix_value())(i,j)) != 0) )
                    count++;
        *(Jc + arg.columns()) = count;

        count = 0;
        for (j = 0; j < arg.columns(); j++)
        {
          *(Jc + j) = count;
          for (i = 0; i< arg.rows(); i++)
             if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                (imag((arg.complex_matrix_value())(i, j)) != 0)) count++;
        }
    }

    return Jc;
}

Here is the caller graph for this function:

double* oct_GetSparsePi ( octave_value  arg  ) 

Definition at line 86 of file oct_get_prpi.cpp.

                                          {
    double *pi;
    int    i, j;
    int    count;
    int    index;
  
    if (arg.is_real_type()) {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) count++;
               
        pi = (double *) malloc(count * sizeof(double));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i<arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) {
                    *(pi + index) = 0;
                    index++;
                }
    } else {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0))
                    count++;
  
        pi = (double *) malloc(count*sizeof(double));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0)) {
                    *(pi + index) = imag((arg.complex_matrix_value())(i, j));
                    index++;
                }
      
    }

    return pi;
}

Here is the caller graph for this function:

double* oct_GetSparsePr ( octave_value  arg  ) 

Definition at line 43 of file oct_get_prpi.cpp.

                                          {
    double *pr;
    int i, j;
    int count;
    int index;

    if (arg.is_real_type()) {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((arg.matrix_value())(i, j) != 0) count++;
    
        pr = (double *) malloc(count * sizeof(double));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for(i = 0; i < arg.rows(); i++)
                if( (arg.matrix_value())(i,j) != 0 ) {
                    *(pr + index) = (arg.matrix_value())(i, j);
                    index++;
                }
    } else {
        count = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0) )
                    count++;
    
        pr = (double *) malloc(count * sizeof(double));
        index = 0;
        for (j = 0; j < arg.columns(); j++)
            for (i = 0; i < arg.rows(); i++)
                if ((real((arg.complex_matrix_value())(i, j)) != 0) ||
                    (imag((arg.complex_matrix_value())(i, j)) != 0)) {
                    *(pr + index) = real((arg.complex_matrix_value())(i, j));
                    index++;
                }

    }

    return pr;
}

Here is the caller graph for this function: