الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

التعامل مع المصفوفات المنطقية

بدأه justalayoubi في 11 مايو 2012 · 40 رد · 3,254 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#26

السلام عليكم

حاول تقسيم الكود إلى 3 أكواد صغيرة (منفصلة عن بعضها البعض) :

  • كود يحسب منقول المصفوفة A
  • كود يحسب مقلوب المصفوفة B
  • كود يحسب جداء مصفوفتين (يمكنك إسناد قيم المصفوفتين يدويا لتتأكد من مُخرجات الكود)

بالتوفيق.

تم تعديل هذه المشاركة بواسطة أحمد الشنقيطي في 12 مايو 2012 في 16:13

#27
justalayoubi كتب:

منقول المصفوفه ان تجعل صفوف المصفوفه اعمدتها والاعمده صفوف

فهمت كل شيء في سؤالك باستثناء منقول المصفوفة

مثلا

      A[2][3]= 

    {

    {0,0,1} ,
    {0,1,1}   

    };

فتصبح هكدا

         A[3][2]= 

    {

    {0,0} ,
    {0,1} ,  
    {1,1}

    };

هكذا تكون المصفوفة المنقولة أم أن هناك علاقة رياضية ما ؟

لأني لما أضرب المصفوفتين مع بعضهما البعض يعطيني حاصلا غير حاصل المصفوفة x

i love you mama

#28

وهذا مافعلته في برنامجي ... جزأته لثلاث أجزاء كما ذكرت .

وعند التطبيق يوجد اولا منقول المصفوفه الاولي ومن ثم يوجد معكوس المصفوفه الثانيه ولكن المشكله في الجزء الثالث :sad:

#29

نعم بالضبط هكذا منقول المصفوفه وفي برنامجي الجزء الخاص بمنقول المصفوفه يعمل جيدا ...

void inverse(float *AT, int ra, int ca)
{

    float d, m;
    int i, j, k;

    for (i = 0; i < ra; i++)
        for (j = 0; j < ca; j++)
        {
            a[j] = AT[ca * i + j];
            cout << a[j] << "\n";
        }


    for (i = 0; i < ca; i++)
    {
        for (j = 0; j < ra; j++)
        {
            if (i == j)
                b[j] = 1;
            else
                b[j] = 0;
        }
    }

    if (a[0][0] == 0)
    {
        for (j = 0; j < ca; j++)
        {
            c[0][j] = b[1][j];
            c[0][j] = a[1][j];
            a[1][j] = a[0][j];
            a[0][j] = c[0][j];
            b[1][j] = b[0][j];
            b[0][j] = c[0][j];
        }
    }

    for (i = 0; i < ca; i++)
    {
        d = a;

        for (j = 0; j < ra; j++)
        {
            a[j] = a[j] / d;
            b[j] = b[j] / d;
        }

        for (k = 0; k < ca; k++)
        {
            if (k != i)
            {
                m = a[k];
                for (j = 0; j < ra; j++)
                {
                    a[k][j] = a[k][j]-(a[j] * m);
                    b[k][j] = b[k][j]-(b[j] * m);
                }
            }
        }
    }

    cout << "\nInverse of matrix is:\n"; 
    for (i = 0; i < ca; i++)
    {
        for (j = 0; j < ra; j++)
            printf(" %f ", b[j]);

        printf("\n");

    }
    std::cin.get(); 
	//getch();
} = ';
#30

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته

مرحباً بكم في منتدى الفريق العربي للبرمجة

نود تنبيهك أن العنوان غير مناسب.

الرجاء اختيار عنوان مناسب أكثر في مواضيعك القادمة، وهذا بمثابة إشعار للأهمية.

وفي حال التكرار سيتعرض موضوعك للإغلاق والحذف!!!

قواعد المشاركة

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

مدونتي: C++ Tips and Tricks

#31

الا يوجد احد يقول شئ ؟ :sad:

انا والله منتظر ... هذا برنامج مصيري يا اخوتي

#32
justalayoubi كتب:

السلام عليكم ورحمه الله .... جمعة مباركه علي الجميع

اخوتي طلب مني برنامج بلغه ++c علي المصفوفات البولينيه boolean matrix , مثلاً إذا كان

1 A = 0 0

1 1 0

B = 1 1 1

1 1 1

0 0 0

من ثم الخرج يكون X

X = 1 1 1

1 1 1

علي حسب فهمي للمساله :wink: : اوجدت منقول المصفوفه A و من ثم ضربتها في معكوس المصفوفه B واخيرا حسبت معكوس الناتج و كانت النتيجه قيم X :wacko:

أعتقد أن مثالك خاطئ ولا حظ معي جيدا بالصور الخطوات المتبعة

3sl12051.jpg

لحد الآن قمنا بالخطوة الأولى وهي إيجاد منقول المصفوفة A و معكوس المصفوفة B

ولكن في الخظوة التانية عند ما نضرب المصفوفتين بعضهما ببعض

ها هو الحاصل الناتج مخالفا تماما لحاصل المصفوفة X

SOl13284.jpg

و بإمكانك التأكد بنفسك وه هاي الطريقة الرياضية المتبعة في ضرب المصفوفات

مرفوقة بمثال

yJn12051.jpg

حاول في المرة القادمة أن تأتينا بمثال صحيح

وفقك الله

تم تعديل هذه المشاركة بواسطة مومو (momo) في 13 مايو 2012 في 15:48

i love you mama

#33

اسف للخطأ الغير مقصود ....

ولكن يا أخي المقصود ليس المثال ولكن الكود .. المثال لشرح فكره الكود فقط .

#34

أخى تفضل الكود الآتى سيعمل ادخال المصفوفات بشكل ديناميكى

أخى ما باقى الا كود ضرب المصفوفتين ووضع الناتج فى مصفوفة جديدة فقط :

انا سأحاول فية أن تبقى وقت.... أو يكملة احد الاعضاء.

والكود بة كود للتحقق من العمليات التى تمت.

#include<iostream> 
#include<string>
using namespace std;

int main()
{
    int row, col;
    // لادخال عدد الصفوف والاعمدة بالمصفوفة
    /////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen A matrix------------------------------" << endl;
    int a_rows = 0, a_cols = 0;
    cout << "Please enter rows: ";
    cin >> a_rows;
    cout << "Please enter cols: ";
    cin >> a_cols;

    int *pnewrow;
    int **A = new int * [a_rows];
    int i, x;
    for (i = 0; i < a_rows; i++)
    {
        pnewrow = new int[a_cols];
        *(A + i) = pnewrow;
        for (x = 0; x < a_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(A + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen B matrix------------------------------" << endl;
    int b_rows = 0, b_cols = 0;
    cout << "Please enter rows: ";
    cin >> b_rows;
    cout << "Please enter cols: ";
    cin >> b_cols;
    int **B = new int * [b_rows];
    for (i = 0; i < b_rows; i++)
    {
        pnewrow = new int[b_cols];
        *(B + i) = pnewrow;
        for (x = 0; x < b_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(B + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////////
    // TRANSPOSE A matrix
    int t_a_rows = a_cols, t_a_cols = a_rows;
    int **t_A = new int * [t_a_rows];

    for (i = 0; i < t_a_rows; i++)
    {
        pnewrow = new int[t_a_cols];
        *(t_A + i) = pnewrow;
        for (x = 0; x < t_a_cols; x++)
            *(*(t_A + i) + x) = *(*(A + x) + i); // or cin >> *(pnewrow+x);        }
    }// end of Transpose A 


    ////////////////////////////////////////////////////////////////////////////////
    ///INVERSE B
    // == 0 --------> 1
    // <> 0 --------> 0  
    int temp = 0;
    for (i = 0; i < b_rows; i++)
        for (x = 0; x < b_cols; x++)
        {
            temp = *(*(B + i) + x);
            *(*(B + i) + x) = (temp == 0) ? 1 : 0; // or cin >> *(pnewrow+x);        
        }
    ///end INVERSE B

    // test programs:
    cout << "Transpose A " << endl;
    for (i = 0; i < t_a_rows; i++)
    {
        for (x = 0; x < t_a_cols; x++)
            cout << *(*(t_A + i) + x) << " "; // or cin >> *(pnewrow+x);        }
        cout << endl;
    }// end of Transpose A 

    cout << "INVERSE B" << endl;

    for (i = 0; i < b_rows; i++)
    {
        for (x = 0; x < b_cols; x++)
            cout << *(*(B + i) + x) << " "; // or cin >> *(pnewrow+x);        

        cout << endl;
    }
    //////////////////////////////////////////////////////////
    ///////// delete heap memory .... //////////////////////
    // delete B matrix ....this is must be last code ...
    for (x = 0; x < b_rows; x++)
        delete [] B[x];
    delete [] B;
    // delete t_A matrix ....this is must be last code ...
    for (x = 0; x < t_a_rows; x++)
        delete [] t_A[x];
    delete [] t_A;

    // delete A  Matrix .....this is must be last code ...
    for (x = 0; x < a_rows; x++)
        delete [] A[x];
    delete [] A;
/////////////////////////end of memeory deleting /////////////////
    return 0;
}

المدخلات وتحقق من المخرجات

--------------------The Boalen A matrix------------------------------
Please enter rows: 3
Please enter cols: 2
Row: 1 Col: 1: 1
Row: 1 Col: 2: 2
Row: 2 Col: 1: 3
Row: 2 Col: 2: 4
Row: 3 Col: 1: 5
Row: 3 Col: 2: 6

--------------------The Boalen B matrix------------------------------
Please enter rows: 2
Please enter cols: 2
Row: 1 Col: 1: 1
Row: 1 Col: 2: 1
Row: 2 Col: 1: 1
Row: 2 Col: 2: 0
Transpose A 
1 3 5 
2 4 6 
INVERSE B
0 0 
0 1 

RUN SUCCESSFUL (total time: 29s)

والله من وراء القصد...

تم تعديل هذه المشاركة بواسطة AudaNix في 18 مايو 2012 في 12:29

post-15367-027053900%201340345097.gifpost-15367-087183200%201340344597.gif
post-247365-0-10080400-1379403554_thumb.

#35

أخي الكريم :

وفقك الله في كل خطوه تخطوها في حياتك ودنياك وجعلك من المبشرين بالجنه ورفقه المصطفي صلاه الله والسلام عليه في الآخره

#36

للاسف لا يعطيني مخرجات :sad:

يعطيني هذه الرساله :-

'uloha 2.exe': Loaded 'C:\Users\salah\Documents\Visual Studio 2008\Projects\uloha 2\Debug\uloha 2.exe', Symbols loaded.
'uloha 2.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'uloha 2.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'uloha 2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcp90d.dll', Symbols loaded.
'uloha 2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll', Symbols loaded.
The program '[2072] uloha 2.exe: Native' has exited with code 0 (0x0).
#37

اخى الكريم هذا الكود قياسي أى يعمل على اى بيئة تشغيل ....

تم عمل الكود بأستخدام بيئتى NetBeans 7.1 و كود بلوك 10.05 تحت نظام تشغيل Ubuntu 10.10

والخطأ الفنى الذى نسيناه أننا لم نحرر الذاكرة التى تم حجزها ديناميكيا ... لقد عدلنا المشاركة واضفنا لها أكود تحرير الذاكرة ....

للأسف ان لا امتلك أى نسخة من مترجمات ميكروسوفت سوى نسخة قديمة سأحاول البحث وتجربة الكود.

والله من وراء القصد

post-15367-027053900%201340345097.gifpost-15367-087183200%201340344597.gif
post-247365-0-10080400-1379403554_thumb.

#38

السلام عليكم ورحمه الله ... وجمعه مباركه علي الجميع

الحمدلله خفت حمي الامتحانات (لم تنتهي ولكن خفت) وعدت من جديد لمواصله البرنامج .

حاولت كتابه باقى الكود (ضرب المصفوفتين) ولكن يعطيني 3 اخطاء

المرجو المساعده يااخوتي

#include <cstdlib>
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
    int row, col, mult, k ;
    /////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen A matrix------------------------------" << endl;
    int a_rows = 0, a_cols = 0;
    cout << "Please enter rows: ";
    cin >> a_rows;
    cout << "Please enter cols: ";
    cin >> a_cols;

    int *pnewrow;
    int **A = new int * [a_rows];
    int i, x;
    for (i = 0; i < a_rows; i++)
    {
        pnewrow = new int[a_cols];
        *(A + i) = pnewrow;
        for (x = 0; x < a_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(A + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen B matrix------------------------------" << endl;
    int b_rows = 0, b_cols = 0;
    cout << "Please enter rows: ";
    cin >> b_rows;
    cout << "Please enter cols: ";
    cin >> b_cols;
    int **B = new int * [b_rows];
    for (i = 0; i < b_rows; i++)
    {
        pnewrow = new int[b_cols];
        *(B + i) = pnewrow;
        for (x = 0; x < b_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(B + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////////
    // TRANSPOSE A matrix
    int t_a_rows = a_cols, t_a_cols = a_rows;
    int **t_A = new int * [t_a_rows];

    for (i = 0; i < t_a_rows; i++)
    {
        pnewrow = new int[t_a_cols];
        *(t_A + i) = pnewrow;
        for (x = 0; x < t_a_cols; x++)
            *(*(t_A + i) + x) = *(*(A + x) + i); // or cin >> *(pnewrow+x);        }
    }// end of Transpose A 

    ////////////////////////////////////////////////////////////////////////////////
    ///INVERSE B
    // == 0 --------> 1
    // <> 0 --------> 0  
    int temp = 0;
    for (i = 0; i < b_rows; i++)
        for (x = 0; x < b_cols; x++)
        {
            temp = *(*(B + i) + x);
            *(*(B + i) + x) = (temp == 0) ? 1 : 0; // or cin >> *(pnewrow+x);        
        }
    ///end INVERSE B

    // test programs:
    cout << "Transpose A " << endl;
    for (i = 0; i < t_a_rows; i++)
    {
        for (x = 0; x < t_a_cols; x++)
            cout << *(*(t_A + i) + x) << " "; // or cin >> *(pnewrow+x);        }
        cout << endl;
    }// end test of Transpose A 

    cout << "INVERSE B" << endl;

    for (i = 0; i < b_rows; i++)
    {
        for (x = 0; x < b_cols; x++)
            cout << *(*(B + i) + x) << " "; // or cin >> *(pnewrow+x);        

        cout << endl;
    } // end test of Inverse B 

	/////////////////////////////////////////////////////////////////
	// Multiply Transpose A & Inverse B (M matrix)
    int INVERSE ;
	int Transpose ;
    cout << "The result of the multiplication is as follows " << endl;

	for(i=0;i<a_rows;i++)
        {
            for(x=0;x<b_cols;x++)
            {
               // mult[x]=0;
                for(k=0;k<a_rows;k++)
                {
                   *(*(mult[x])+ )=*(*(Transpose [k] )* INVERSE [k][x]);
                    cout << mult[x] << " "; // or cin >> *(pnewrow+x);        

        cout << endl;
				}
			}
	}
 // end of Multiply
return 0;
}
//////////////////////////////////////////////////////////////////////////////////
    // ///INVERSE M
    // == 0 --------> 1
    // <> 0 --------> 0
	/*int k_rows = a_rows, k_cols = a_cols;
    int temp2 = 0;
    for (i = 0; i < k_rows; i++)
        for (x = 0; x < k_cols; x++)
        {
            temp2 = *(*(k + i) + x);
            *(*(k + i) + x) = (temp2 == 0) ? 1 : 0; // or cin >> *(pnewrow+x);        
        }
    ///end INVERSE M */


= ';
#39

وهذه هي الاخطاء التي احصل عليها ..........

1>------ Build started: Project: Ulohe 2, Configuration: Debug Win32 ------
1>Compiling...
1>bool.cpp
1>c:\users\salah\documents\visual studio 2008\projects\ulohe 2\ulohe 2\bool.cpp(107) : error C2109: subscript requires array or pointer type
1>c:\users\salah\documents\visual studio 2008\projects\ulohe 2\ulohe 2\bool.cpp(107) : error C2059: syntax error : ')'
1>c:\users\salah\documents\visual studio 2008\projects\ulohe 2\ulohe 2\bool.cpp(108) : error C2109: subscript requires array or pointer type
1>Build log was saved at "file://c:\Users\salah\Documents\Visual Studio 2008\Projects\Ulohe 2\Ulohe 2\Debug\BuildLog.htm"
1>Ulohe 2 - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#40

السلام عليكم

الخطأ يكمن في هذين السطرين :

*(*(mult[x])+ )=*(*(Transpose [k] )* INVERSE [k][x]);
cout << mult[x] << " ";

المتغيرات mult, Transpose و INVERSE هي متغيرات من النوع int, و المشكلة أنك تتعامل معها و كأنها مؤشرات !!

بالمناسبة, نرجو منكم اختيار العنوان المناسب لموضوعكم في المرات القادمة.

تم تغيير العنوان.

أرجو لكم التوفيق.

#41

الحمدلله تمكنت من معالجه اخطاء عمليه الضرب الي حد كبير , ولكن لاتزال هناك اخطاء في المخرجات

وهذا هو البرنامج بعد المعالجات ....

#include <cstdlib>
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
    int row, col, mult[10][10], k, sum ;
    /////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen A matrix------------------------------" << endl;
    int a_rows = 0, a_cols = 0;
    cout << "Please enter rows: ";
    cin >> a_rows;
    cout << "Please enter cols: ";
    cin >> a_cols;

    int *pnewrow;
    int **A = new int * [a_rows];
    int i, x;
    for (i = 0; i < a_rows; i++)
    {
        pnewrow = new int[a_cols];
        *(A + i) = pnewrow;
        for (x = 0; x < a_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(A + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////
    cout << endl << "--------------------The Boalen B matrix------------------------------" << endl;
    int b_rows = 0, b_cols = 0;
    cout << "Please enter rows: ";
    cin >> b_rows;
    cout << "Please enter cols: ";
    cin >> b_cols;
    int **B = new int * [b_rows];
    for (i = 0; i < b_rows; i++)
    {
        pnewrow = new int[b_cols];
        *(B + i) = pnewrow;
        for (x = 0; x < b_cols; x++)
        {
            cout << "Row: " << i + 1 << " Col: " << x + 1 << ": ";
            cin >> *(*(B + i) + x); // or cin >> *(pnewrow+x);
        }
    }
    //////////////////////////////////////////////////////////////////////////////////
    // TRANSPOSE A matrix
    int t_a_rows = a_cols, t_a_cols = a_rows;
    int **t_A = new int * [t_a_rows];

    for (i = 0; i < t_a_rows; i++)
    {
        pnewrow = new int[t_a_cols];
        *(t_A + i) = pnewrow;
        for (x = 0; x < t_a_cols; x++)
            *(*(t_A + i) + x) = *(*(A + x) + i); // or cin >> *(pnewrow+x);        }
    }// end of Transpose A 

    ////////////////////////////////////////////////////////////////////////////////
    ///INVERSE B
    // == 0 --------> 1
    // <> 0 --------> 0  
    int temp = 0;
    for (i = 0; i < b_rows; i++)
        for (x = 0; x < b_cols; x++)
        {
            temp = *(*(B + i) + x);
            *(*(B + i) + x) = (temp == 0) ? 1 : 0; // or cin >> *(pnewrow+x);        
        }
    ///end INVERSE B

    // test programs:
    cout << "Transpose " << endl;
    for (i = 0; i < t_a_rows; i++)
    {
        for (x = 0; x < t_a_cols; x++)
            cout << *(*(t_A + i) + x) << " "; // or cin >> *(pnewrow+x);        }
        cout << endl;
    }// end test of Transpose A 

    cout << "INVERSE" << endl;

    for (i = 0; i < b_rows; i++)
    {
        for (x = 0; x < b_cols; x++)
            cout << *(*(B + i) + x) << " "; // or cin >> *(pnewrow+x);        

        cout << endl;
    } // end test of Inverse B 

	/////////////////////////////////////////////////////////////////
	// Multiply Transpose A & Inverse B (K matrix)
	int k_rows =0, k_cols = 0;
    int INVERSE[10][10];
	int Transpose[10][10] ;


	for(i=0;i<a_rows;i++)
        {
            for(x=0;x<b_cols;x++)
            {
               // mult[x]=0;
                for(k=0;k<b_rows;k++)
                {
                  // mult[x]= mult[x] + Transpose[k] * INVERSE[k][x];
                   //cout << mult[x] << " "; // or cin >> *(pnewrow+x);

      sum = sum + Transpose[k]*INVERSE[k][x];
        }

       mult[x] = sum;
       sum = 0;
      if (sum > 1)
        {
            sum = 1;
        }
    } 
}
	cout << "Multiply K = Transpose A* Inverse B  " << endl;
for ( i = 0 ; i <a_rows ; i++ )
    {
      for ( x = 0 ; x < b_cols ; x++ )
        cout << mult[x] << " ";

      cout << endl;
} 
/////////////////////////////////////
///INVERSE 
    // == 0 --------> 1
    // <> 0 --------> 0 
    int **K = new int * [k_rows];
    int temp2 = 0;
    for (i = 0; i < k_rows; i++)
        for (x = 0; x < k_cols; x++)
        {
            temp2 = *(*(K + i) + x);
            *(*(K + i) + x) = (temp2 == 0) ? 1 : 0; // or cin >> *(pnewrow+x);        
        }
    ///end INVERSE K

cout << "INVERSE K" << endl;

    for (i = 0; i < k_rows; i++)
    {
        for (x = 0; x < k_cols; x++)
            cout << *(*(K + i) + x) << " "; // or cin >> *(pnewrow+x);        

        cout << endl;
    } // end test of Inverse B
getchar();
getchar(); 
return 0;
}

= ';

و تكون المخرجات علي الشكل

--------------------The Boalen A matrix------------------------------
Please enter rows: 3
Please enter cols: 2
Row: 1 Col: 1: 0
Row: 1 Col: 2: 0
Row: 2 Col: 1: 1
Row: 2 Col: 2: 1
Row: 3 Col: 1: 1
Row: 3 Col: 2: 0

--------------------The Boalen B matrix------------------------------
Please enter rows: 3
Please enter cols: 3
Row: 1 Col: 1: 0
Row: 1 Col: 2: 1
Row: 1 Col: 3: 0
Row: 2 Col: 1: 1
Row: 2 Col: 2: 1
Row: 2 Col: 3: 1
Row: 3 Col: 1: 1
Row: 3 Col: 2: 1
Row: 3 Col: 3: 1
Transpose
0 1 1
0 1 0
INVERSE
1 0 1
0 0 0
0 0 0
Multiply K = Transpose A* Inverse B
1202590844 2061584304 2061584304
2061584304 2061584304 2061584304
2061584304 2061584304 2061584304
INVERSE K


=';

و هنا تظهر المشكله ( في المخرجات) , فحاصل الضرب لابد ان يكون 0 و1 فقط لان المصفوفه بولينيه وفي البرنامج كتبت شرط لذلك (اتمني ان يكون صحيحاُ)

if (sum > 1)
        {
            sum = 1;
        }

=';

اما المشكله الثانيه فالبرنامج لاينفذ امر عكس الناتج , فقط يكتب INVERSE K ولايعطي اي قيم

تم تعديل هذه المشاركة بواسطة justalayoubi في 1 يوليو 2012 في 03:42

مواضيع مشابهة