Example usage for org.apache.commons.math.complex Complex ONE

List of usage examples for org.apache.commons.math.complex Complex ONE

Introduction

In this page you can find the example usage for org.apache.commons.math.complex Complex ONE.

Prototype

Complex ONE

To view the source code for org.apache.commons.math.complex Complex ONE.

Click Source Link

Document

A complex number representing "1.0 + 0.0i"

Usage

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = sec(a) /*  www  . ja  v  a  2s. c  o m*/
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexSec(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.cos());

    c.x = out.getReal();
    c.y = out.getImaginary();

    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = csc(a) //  w ww  .  j av a2  s .  c  om
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexCsc(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.sin());

    c.x = out.getReal();
    c.y = out.getImaginary();

    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = cot(a) //from w  w w .j a  v a  2s  .  co m
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexCot(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.tan());

    c.x = out.getReal();
    c.y = out.getImaginary();

    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = sech(a) //from w  w  w  .ja  va 2s . c  om
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexSech(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.cosh());

    c.x = out.getReal();
    c.y = out.getImaginary();
    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = csc(a) // w  w  w.  j a  v  a 2 s .c o  m
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexCsch(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.sinh());

    c.x = out.getReal();
    c.y = out.getImaginary();

    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:geogebra.common.kernel.geos.GeoVec2D.java

/**
 * c = cot(a) /*from   w w w .j  a v  a 2s.  co m*/
 * 
 * @param a
 *            a
 * @param c
 *            c
 */
final public static void complexCoth(GeoVec2D a, GeoVec2D c) {
    Complex out = new Complex(a.x, a.y);
    out = Complex.ONE.divide(out.tanh());

    c.x = out.getReal();
    c.y = out.getImaginary();
    c.setMode(Kernel.COORD_COMPLEX);
}

From source file:InternalFrame.InternalFrameproject.java

private Observer calculateELPAM(int metoda, boolean bundle, boolean aproxx, boolean exactGMR, boolean exactRAC,
        boolean makeTxt, boolean parametrical) {
    Observer output = new Observer();

    try {//from w  ww  .j ava 2 s  .c  o  m

        //vytvorenie zoznamu vodicov ako su pouzite v mainframe
        int pocet_vodicov = Rozptie.getRetazovkaList().size();
        ArrayList<elpam_input_conductor> cnd_list = new ArrayList<>();

        for (int i = 0; i < pocet_vodicov; i++) {
            elpam_input_conductor cnd2add = new elpam_input_conductor(); //treba vzdy definovat nanovo nech neprepisuje ArrayList!!!!!!!!!!!!
            Rozptie.getRetazovkaList().get(i).calcGMR_Rac_xi();
            cnd2add.setF(constants.getFrequency());
            cnd2add.setD(Rozptie.getRetazovkaList().get(i).getElpam_D());
            cnd2add.setT(Rozptie.getRetazovkaList().get(i).getElpam_T());
            cnd2add.setRho_conductor(Rozptie.getRetazovkaList().get(i).getElpam_rho_cnd());
            cnd2add.setRho_ground(Rozptie.getRetazovkaList().get(i).getElpam_rho_gnd());
            cnd2add.setRdc(Rozptie.getRetazovkaList().get(i).getElpam_Rdc());
            cnd2add.setAl_layers(Rozptie.getRetazovkaList().get(i).getElpam_Al_layers());
            cnd2add.setAl_start(Rozptie.getRetazovkaList().get(i).getElpam_Al_start());
            cnd2add.setAl_d(Rozptie.getRetazovkaList().get(i).getElpam_Al_d());
            cnd2add.setGMR(Rozptie.getRetazovkaList().get(i).getElpam_GMR());
            cnd2add.setRac(Rozptie.getRetazovkaList().get(i).getElpam_Rac());
            cnd2add.setXi(Rozptie.getRetazovkaList().get(i).getElpam_xi());
            cnd2add.setGMR_default(Rozptie.getRetazovkaList().get(i).getElpam_GMR_default());
            cnd2add.setXi_default(Rozptie.getRetazovkaList().get(i).getElpam_xi_default());
            cnd2add.setBundle(Rozptie.getRetazovkaList().get(i).isBundle());
            cnd_list.add(i, cnd2add);
        }

        //definovanie realmatrix premennych - zistovanie ich velkosti - .get(xyz) hovori o elementoch v rozpati
        //int element = 0; //nastavenie useku v retazovke
        if (progress_bar_current_cycle == 1) {
            this.progress_bar_value = 0;
        }
        //false -> uvazuje klasicky prepocet cez r_zv, true -> vodice vo zvazku ako nove lana v systeme

        Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385); //nutne pre stanovenie velkosti matic
        int gw = Rozptie.getPocet_zemnych_lan_bez_zvazkov();
        int fv = Rozptie.getPocet_faz();
        int number_of_elements = Rozptie.getRetazovkaList().get(0).getRo_vectors().size();

        /**
         * method: 1 - Carson no gnd 2 - Carson gnd 3 - Carson mod no gnd 4
         * - Carson mod gnd 5 - Basic 6 - CDER 7 - TakuNoda
         */
        int method = metoda;
        String type = "phase";
        if (Rozptie.getPocet_faz() % 3 == 0) {
            type = "all";
        }

        //ArrLists for Impedance/Admittance - phase matrices, symmetrical components matrices
        //ComplexMatrices for Impedance/Admittance - phase matrices, symmetrical components matrices
        ArrayList<ComplexMatrix> Y_total = new ArrayList<>();
        ArrayList<ComplexMatrix> Y_total_symm = new ArrayList<>();
        ComplexMatrix Y_total_final = new ComplexMatrix(fv, fv);
        ComplexMatrix Y_total_symm_final = new ComplexMatrix(fv, fv);
        if (method == 1) {
            ArrayList<ComplexMatrix> Z_total_Carson_no_gnd = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_Carson_no_gnd_symm = new ArrayList<>();
            ComplexMatrix Z_total_Carson_no_gnd_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_Carson_no_gnd_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Fik = new Array2DRowRealMatrix(rows, cols);
                double[] hx2 = new double[rows];

                //Carson & Carson Modified & Basic
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                Fik = Rozptie.getPAr_Alpha_real().get(element);
                hx2 = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));

                Carson test_carson = new Carson(Dik, Dik_mirror_real, Fik, hx2, cnd_list, exactGMR, exactRAC,
                        fv, gw);
                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                test_carson.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_Carson_no_gnd.add(test_carson.getZ_red_no_gnd());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_Carson_no_gnd_symm.add(test_carson.getZ_red_no_gnd_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_Carson_no_gnd = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Carson_no_gnd_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_Carson_no_gnd = cSum_Carson_no_gnd.plus(Z_total_Carson_no_gnd.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_Carson_no_gnd_symm = cSum_Carson_no_gnd_symm.plus(Z_total_Carson_no_gnd_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_Carson_no_gnd_final = cSum_Carson_no_gnd.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_Carson_no_gnd_symm_final = cSum_Carson_no_gnd_symm
                        .times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_Carson_no_gnd_final, Y_total_final, Z_total_Carson_no_gnd_symm_final,
                    Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 2) {
            ArrayList<ComplexMatrix> Z_total_Carson_gnd = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_Carson_gnd_symm = new ArrayList<>();
            ComplexMatrix Z_total_Carson_gnd_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_Carson_gnd_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Fik = new Array2DRowRealMatrix(rows, cols);
                double[] hx2 = new double[rows];

                //Carson & Acrson Modified & Basic & Admittance
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                Fik = Rozptie.getPAr_Alpha_real().get(element);
                hx2 = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));

                Carson test_carson = new Carson(Dik, Dik_mirror_real, Fik, hx2, cnd_list, exactGMR, exactRAC,
                        fv, gw);

                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                test_carson.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_Carson_gnd.add(test_carson.getZ_red_gnd());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_Carson_gnd_symm.add(test_carson.getZ_red_gnd_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_Carson_gnd = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Carson_gnd_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_Carson_gnd = cSum_Carson_gnd.plus(Z_total_Carson_gnd.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                    cSum_Carson_gnd_symm = cSum_Carson_gnd_symm.plus(Z_total_Carson_gnd_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_Carson_gnd_final = cSum_Carson_gnd.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_Carson_gnd_symm_final = cSum_Carson_gnd_symm.times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_Carson_gnd_final, Y_total_final, Z_total_Carson_gnd_symm_final,
                    Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 3) {
            ArrayList<ComplexMatrix> Z_total_Carson_mod_no_gnd = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_Carson_mod_no_gnd_symm = new ArrayList<>();
            ComplexMatrix Z_total_Carson_mod_no_gnd_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_Carson_mod_no_gnd_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Fik = new Array2DRowRealMatrix(rows, cols);
                double[] hx2 = new double[rows];

                //Carson & Acrson Modified & Basic
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                Fik = Rozptie.getPAr_Alpha_real().get(element);
                hx2 = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));

                CarsonModified test_carson_mod = new CarsonModified(Dik, Dik_mirror_real, Fik, hx2, cnd_list,
                        exactGMR, exactRAC, fv, gw);
                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                //                        System.out.println();
                //                        System.out.println("Carson modified");
                test_carson_mod.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_Carson_mod_no_gnd.add(element, test_carson_mod.getZ_red_no_gnd());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_Carson_mod_no_gnd_symm.add(element, test_carson_mod.getZ_red_no_gnd_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_Carson_mod_no_gnd = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Carson_mod_no_gnd_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_Carson_mod_no_gnd = cSum_Carson_mod_no_gnd.plus(Z_total_Carson_mod_no_gnd.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_Carson_mod_no_gnd_symm = cSum_Carson_mod_no_gnd_symm
                            .plus(Z_total_Carson_mod_no_gnd_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_Carson_mod_no_gnd_final = cSum_Carson_mod_no_gnd.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_Carson_mod_no_gnd_symm_final = cSum_Carson_mod_no_gnd_symm
                        .times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_Carson_mod_no_gnd_final, Y_total_final,
                    Z_total_Carson_mod_no_gnd_symm_final, Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 4) {
            ArrayList<ComplexMatrix> Z_total_Carson_mod_gnd = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_Carson_mod_gnd_symm = new ArrayList<>();
            ComplexMatrix Z_total_Carson_mod_gnd_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_Carson_mod_gnd_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Fik = new Array2DRowRealMatrix(rows, cols);
                double[] hx2 = new double[rows];

                //Carson & Acrson Modified & Basic
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                Fik = Rozptie.getPAr_Alpha_real().get(element);
                hx2 = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));

                CarsonModified test_carson_mod = new CarsonModified(Dik, Dik_mirror_real, Fik, hx2, cnd_list,
                        exactGMR, exactRAC, fv, gw);
                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                test_carson_mod.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_Carson_mod_gnd.add(test_carson_mod.getZ_red_gnd());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_Carson_mod_gnd_symm.add(test_carson_mod.getZ_red_gnd_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_Carson_mod_gnd = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Carson_mod_gnd_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_Carson_mod_gnd = cSum_Carson_mod_gnd.plus(Z_total_Carson_mod_gnd.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_Carson_mod_gnd_symm = cSum_Carson_mod_gnd_symm
                            .plus(Z_total_Carson_mod_gnd_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_Carson_mod_gnd_final = cSum_Carson_mod_gnd.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_Carson_mod_gnd_symm_final = cSum_Carson_mod_gnd_symm
                        .times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_Carson_mod_gnd_final, Y_total_final,
                    Z_total_Carson_mod_gnd_symm_final, Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 5) {
            ArrayList<ComplexMatrix> Z_total_Basic = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_Basic_symm = new ArrayList<>();
            ComplexMatrix Z_total_Basic_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_Basic_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real = new Array2DRowRealMatrix(rows, cols);
                double[] hx2;

                //Carson & Acrson Modified & Basic
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, Complex.ONE, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                hx2 = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));

                Basic test_basic = new Basic(Dik, cnd_list, exactGMR, exactRAC, fv, gw);

                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                test_basic.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_Basic.add(test_basic.getZ_red());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_Basic_symm.add(test_basic.getZ_red_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_Basic = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Basic_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_Basic = cSum_Basic.plus(Z_total_Basic.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_Basic_symm = cSum_Basic_symm.plus(Z_total_Basic_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_Basic_final = cSum_Basic.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_Basic_symm_final = cSum_Basic_symm.times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_Basic_final, Y_total_final, Z_total_Basic_symm_final,
                    Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 6) {
            ArrayList<ComplexMatrix> Z_total_CDER = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_CDER_symm = new ArrayList<>();
            ComplexMatrix Z_total_CDER_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_CDER_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real_CDER = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_imag_CDER = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real;
                double[] hx2_real = new double[rows];
                double[] hx2_imag = new double[rows];
                double[] hx2_kap;

                //complex const
                double omega = (double) 2 * Math.PI * constants.getFrequency();
                double mu = (4e-7) * Math.PI;
                Complex p;
                p = new Complex(cnd_list.get(0).getRho_ground(), 0).divide(new Complex(0, omega * mu)).sqrt();

                //CDER
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, p, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                hx2_kap = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));
                Rozptie.calculateMatrix_opt_XX("b", "A", aproxx, bundle, p, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                Rozptie.calculateMatrix_opt_XX("b", "C", aproxx, bundle, p, 0.26244, 1.12385);
                Dik_mirror_real_CDER = Rozptie.getPAr_Dik_REAL().get(element);
                Dik_mirror_imag_CDER = Rozptie.getPAr_Dik_Image().get(element);
                hx2_real = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));
                hx2_imag = ArrList2Arr(Rozptie.getPAr_diagonala_image().get(element));

                CDER cder_test = new CDER(Dik, Dik_mirror_real_CDER, Dik_mirror_imag_CDER, hx2_real, hx2_imag,
                        cnd_list, exactGMR, exactRAC, fv, gw);
                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2_kap, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                cder_test.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_CDER.add(cder_test.getZ_red());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_CDER_symm.add(cder_test.getZ_red_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_CDER = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_CDER_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_CDER = cSum_CDER.plus(Z_total_CDER.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_CDER_symm = cSum_CDER_symm.plus(Z_total_CDER_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_CDER_final = cSum_CDER.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_CDER_symm_final = cSum_CDER_symm.times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_CDER_final, Y_total_final, Z_total_CDER_symm_final,
                    Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);

        } else if (method == 7) {
            ArrayList<ComplexMatrix> Z_total_TakuNoda = new ArrayList<>();
            ArrayList<ComplexMatrix> Z_total_TakuNoda_symm = new ArrayList<>();
            ComplexMatrix Z_total_TakuNoda_final = new ComplexMatrix(fv, fv);
            ComplexMatrix Z_total_TakuNoda_symm_final = new ComplexMatrix(fv, fv);

            //for each element in span
            for (int element = 0; element < number_of_elements; element++) {
                int rows = Rozptie.getPAr_Dik_REAL().get(element).getRowDimension();
                int cols = Rozptie.getPAr_Dik_REAL().get(element).getColumnDimension();

                RealMatrix Dik = new Array2DRowRealMatrix(rows, cols);
                double[] hx2_real_alpha = new double[rows];
                double[] hx2_imag_alpha = new double[rows];
                double[] hx2_real_beta = new double[rows];
                double[] hx2_imag_beta = new double[rows];
                RealMatrix Dik_mirror_real_alpha = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_imag_alpha = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_real_beta = new Array2DRowRealMatrix(rows, cols);
                RealMatrix Dik_mirror_imag_beta = new Array2DRowRealMatrix(rows, cols);

                RealMatrix Dik_mirror_real;
                double[] hx2_kap;

                //complex const
                double omega = (double) 2 * Math.PI * constants.getFrequency();
                double mu = (4e-7) * Math.PI;
                Complex p;
                p = new Complex(cnd_list.get(0).getRho_ground(), 0).divide(new Complex(0, omega * mu)).sqrt();

                //Taku Noda
                Rozptie.calculateMatrix_opt_XX("a", "B", aproxx, bundle, p, 0.26244, 1.12385);
                Dik_mirror_real = Rozptie.getPAr_Dik_REAL().get(element);
                hx2_kap = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));
                //Dik
                Rozptie.calculateMatrix_opt_XX("a", "A", aproxx, bundle, p, 0.26244, 1.12385);
                Dik = Rozptie.getPAr_Dik_REAL().get(element);
                //alpha
                Rozptie.calculateMatrix_opt_XX("c", "D", aproxx, bundle, p, 0.26244, 1.12385);
                hx2_real_alpha = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));
                hx2_imag_alpha = ArrList2Arr(Rozptie.getPAr_diagonala_image().get(element));
                Dik_mirror_real_alpha = Rozptie.getPAr_Dik_REAL().get(element);
                Dik_mirror_imag_alpha = Rozptie.getPAr_Dik_Image().get(element);
                //beta
                Rozptie.calculateMatrix_opt_XX("d", "E", aproxx, bundle, p, 0.26244, 1.12385);
                hx2_real_beta = ArrList2Arr(Rozptie.getPAr_diagonala_real().get(element));
                hx2_imag_beta = ArrList2Arr(Rozptie.getPAr_diagonala_image().get(element));
                Dik_mirror_real_beta = Rozptie.getPAr_Dik_REAL().get(element);
                Dik_mirror_imag_beta = Rozptie.getPAr_Dik_Image().get(element);

                TakuNoda tn_test = new TakuNoda(Dik, Dik_mirror_real_alpha, Dik_mirror_imag_alpha,
                        Dik_mirror_real_beta, Dik_mirror_imag_beta, hx2_real_alpha, hx2_imag_alpha,
                        hx2_real_beta, hx2_imag_beta, cnd_list, exactGMR, exactRAC, fv, gw);

                Admittance test_admittance = new Admittance(Dik, Dik_mirror_real, hx2_kap, cnd_list,
                        Rozptie.getKrok(), Rozptie.getRetazovkaList().get(0).getBundle_over(), fv, gw);

                //compute all parameters
                tn_test.calcAll(type);
                test_admittance.calcAll(type);

                //store to ArrayLists
                Z_total_TakuNoda.add(tn_test.getZ_red());
                Y_total.add(test_admittance.getY());
                if (type.equals("all")) {
                    Z_total_TakuNoda_symm.add(tn_test.getZ_red_symm());
                    Y_total_symm.add(test_admittance.getY_symm());
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            //make average parameters from ArrayLists
            ComplexMatrix cSum_TakuNoda = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_TakuNoda_symm = new ComplexMatrix(fv, fv);
            ComplexMatrix cSum_Y_symm = new ComplexMatrix(fv, fv);

            for (int i = 0; i < number_of_elements; i++) {
                cSum_TakuNoda = cSum_TakuNoda.plus(Z_total_TakuNoda.get(i));
                cSum_Y = cSum_Y.plus(Y_total.get(i));
                if (type.equals("all")) {
                    cSum_TakuNoda_symm = cSum_TakuNoda_symm.plus(Z_total_TakuNoda_symm.get(i));
                    cSum_Y_symm = cSum_Y_symm.plus(Y_total_symm.get(i));
                }

                //vypis no progress baru
                progress_bar_value++;
                double value = (((double) progress_bar_value)
                        / ((double) 2 * (double) number_of_elements * (double) progress_bar_cycles)) * 100; //2 iteratory no n.o.e
                if (value % 5 == 0) {
                    updatePB((int) value);
                }
            }

            Z_total_TakuNoda_final = cSum_TakuNoda.times((double) 1 / number_of_elements);
            Y_total_final = cSum_Y.times((double) 1 / number_of_elements);
            if (type.equals("all")) {
                Z_total_TakuNoda_symm_final = cSum_TakuNoda_symm.times((double) 1 / number_of_elements);
                Y_total_symm_final = cSum_Y_symm.times((double) 1 / number_of_elements);
            }

            //write to observer
            output = new Observer(Z_total_TakuNoda_final, Y_total_final, Z_total_TakuNoda_symm_final,
                    Y_total_symm_final, 0);

            //writin into file
            if (makeTxt)
                make_TXT_ELPAM_Basic(type, method, output);
        }

        if (parametrical) {
            if (progress_bar_current_cycle == progress_bar_cycles) {
                updatePB(100);
            }
        } else {
            updatePB(100);
        }

    } catch (DelaunayError ex) {
        Logger.getLogger(InternalFrameproject.class.getName()).log(Level.SEVERE, null, ex);
    }

    return output;
}