Đối tượng tham chiếu để cho phép tạo các mảng không phải là mảng NumPy. Nếu một mảng giống như được chuyển vào dưới dạng like
hỗ trợ giao thức __array_function__
, thì kết quả sẽ được xác định bởi nó. Trong trường hợp này, nó đảm bảo việc tạo ra một đối tượng mảng tương thích với đối tượng được truyền qua đối số này
Trong bài viết này, chúng tôi sẽ thảo luận về các bước và trực giác để tạo ma trận nhận dạng và hiển thị các ví dụ bằng Python
Mục lục
- Giới thiệu
- Giải thích ma trận nhận dạng
- Thuộc tính ma trận nhận dạng
- Ma trận nhận dạng trong Python
- Phần kết luận
Giới thiệu
Ma trận đơn vị [I] thường thấy trong rất nhiều biểu thức ma trận trong đại số tuyến tính
Tại thời điểm này, bạn nên làm quen với việc hiểu ý nghĩa đằng sau ma trận đồng nhất sẽ rất hữu ích.
Để tiếp tục làm theo hướng dẫn này, chúng ta sẽ cần thư viện Python sau. cục mịch
Nếu bạn chưa cài đặt chúng, vui lòng mở “Command Prompt” [trên Windows] và cài đặt chúng bằng mã sau
pip install numpy
Giải thích ma trận nhận dạng
Chúng ta đã biết, nhưng ma trận nhận dạng chính xác là gì và nó được sử dụng như thế nào?
Ma trận đơn vị I_n là một ma trận vuông cấp n chứa đầy các số 1 trên đường chéo chính và các số 0 ở mọi nơi khác
Đây là vài ví dụ
Hình ảnh của tác giả
và như vậy cho kích thước lớn hơn
Về mặt đồ thị, ma trận I_2 chỉ biểu diễn các vectơ cơ sở
Hình ảnh của tác giả
Hình ảnh của tác giả
Thuộc tính ma trận nhận dạng
Dưới đây là một số thuộc tính hữu ích của ma trận đồng nhất
- Ma trận đơn vị luôn là ma trận vuông [cùng số hàng và cột], chẳng hạn như. 2×2, 3×3, v.v.
- Kết quả của phép nhân bất kỳ ma trận nào với ma trận đơn vị là chính ma trận đó [nếu phép nhân được xác định]
Hình ảnh của tác giả
- Kết quả của phép nhân một ma trận với ma trận nghịch đảo của nó là ma trận đơn vị
Hình ảnh của tác giả
Ma trận nhận dạng trong Python
Để tạo ma trận nhận dạng trong Python, chúng ta sẽ sử dụng thư viện numpy. Và bước đầu tiên sẽ là nhập nó
Numpy có rất nhiều hàm hữu ích và đối với thao tác này, chúng ta sẽ sử dụng hàm nhận dạng [] để tạo một mảng hình vuông chứa đầy các số 1 trong đường chéo chính và các số 0 ở mọi nơi khác
Bây giờ, hãy tạo một ma trận nhận dạng 2×2
Và bạn sẽ nhận được
[[1. 0.]
[0. 1.]]
Bây giờ bạn đã biết cách tạo ma trận đồng nhất và có thể khám phá thêm các phép toán của ma trận bằng cách tính nghịch đảo ma trận và nhân ma trận trong Python
Phần kết luận
Trong bài viết này, chúng tôi đã thảo luận về các bước và trực giác để tạo ma trận nhận dạng, cũng như hiển thị một ví dụ hoàn chỉnh bằng Python
Vui lòng để lại nhận xét bên dưới nếu bạn có bất kỳ câu hỏi nào hoặc có đề xuất cho một số chỉnh sửa và xem thêm các bài viết về Đại số tuyến tính của tôi
Trong đại số tuyến tính, điều này đôi khi được gọi là Ma trận đơn vị, của một ma trận vuông [kích thước = n x n] với các số 1 trên đường chéo chính và các số 0 ở những nơi khác. Ma trận đồng nhất được ký hiệu là “I”. Đôi khi U hoặc E cũng được sử dụng để biểu thị Ma trận nhận dạng.
Một thuộc tính của ma trận đồng nhất là nó không thay đổi ma trận nếu nó được nhân với Ma trận đồng nhất
ví dụ.
Input : 2 Output : 1 0 0 1 Input : 4 Output : 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 The explanation is simple. We need to make all the elements of principal or main diagonal as 1 and everything else as 0.
Chương trình in ma trận nhận dạng. logic rất đơn giản. Bạn cần in 1 ở những vị trí có hàng bằng cột của ma trận và đặt tất cả các vị trí khác bằng 0.
Thực hiện
C++
// C++ program to print Identity Matrix
#include
using
namespace
std;
int
Identity[
int
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 11
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Yes4
Yes2______3_______2
Yes7_______13_______8
Yes7_______575_______0
// C++ program to print Identity Matrix
1// C++ program to print Identity Matrix
2_______575_______3// C++ program to print Identity Matrix
4// C++ program to print Identity Matrix
5
Yes7_______575_______7
// C++ program to print Identity Matrix
2_______575_______9// C++ program to print Identity Matrix
4// C++ program to print Identity Matrix
5
Yes2____576_______3
Yes2____576_______5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
using
2
int
using
4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
using
81 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______578_______0
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
namespace
5
C
namespace
6
namespace
7
int
Identity[
int
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 11
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Yes4
Yes2______3_______2
Yes7_______13_______8
Yes7_______575_______0
// C++ program to print Identity Matrix
1// C++ program to print Identity Matrix
2_______581_______3____581_______4Identity[
5Identity[
6
Yes7_______575_______7
// C++ program to print Identity Matrix
2_______581_______3Identity[
4Identity[
5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 103
Yes2____576_______3
Yes2_______581_______3_______581_______4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 109
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
using
2
int
using
4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
using
81 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______25
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
Java
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 130
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 131
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 132
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 133
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 134
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______37
int
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 139_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 11
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 147
Yes2_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 150
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151_______3_______52
Yes2______3_______2
Yes7_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 157
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 159
Yes7_______3_______2
// C++ program to print Identity Matrix
2______13_______8
// C++ program to print Identity Matrix
2_______575_______0 // C++ program to print Identity Matrix
1
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 168
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 170
// C++ program to print Identity Matrix
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
// C++ program to print Identity Matrix
2______575_______7
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 168
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 170
// C++ program to print Identity Matrix
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes7_______576_______3
Yes7_______3_______84
Yes2____576_______3
Yes2_______576_______9
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 193
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______97
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 137
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 199
Yes00
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
Yes05
Yes06
// C++ program to print Identity Matrix
5Yes2______3_______25
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
#include
3
Yes13
Python3
Yes14
Yes15
Yes16
Yes17
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Yes20
Yes21
Yes22
Identity[
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
Yes25
Yes2_______3_______8
Yes28
Yes21
Yes22
Identity[
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
Yes25
Yes7_______13_______35
Yes7_______575_______0
Yes38
Yes39
Yes39
Yes41
// C++ program to print Identity Matrix
2_______13_______43____581_______4
Yes45
Yes46
Yes39
// C++ program to print Identity Matrix
4Yes49
Yes7_______575_______7
Yes52
// C++ program to print Identity Matrix
2_______13_______43____581_______4
Yes56
Yes46
Yes39
// C++ program to print Identity Matrix
4Yes49
Yes2_______13_______43
Yes63
Yes64
Yes65
Yes39
Yes06
Yes68
C#
Yes69
using
Yes71
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 133
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 134
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______37
int
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 139_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 11
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 15
Yes2
Yes2_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19
Yes2______3_______2
Yes7_______3_______8
Yes4
Yes7_______3_______2
// C++ program to print Identity Matrix
2______13_______8
// C++ program to print Identity Matrix
2_______575_______0 // C++ program to print Identity Matrix
1
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______575_______03
// C++ program to print Identity Matrix
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
// C++ program to print Identity Matrix
2______575_______7
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______575_______09
// C++ program to print Identity Matrix
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes7_______576_______3
Yes7_______575_______15
Yes2____576_______3
Yes2_______576_______9
using
01 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______97
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 137
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 199
// C++ program to print Identity Matrix
301 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
using
8Yes2______3_______25
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
#include
3
// C++ program to print Identity Matrix
41
PHP
// C++ program to print Identity Matrix
42
// C++ program to print Identity Matrix
43
// C++ program to print Identity Matrix
44
// C++ program to print Identity Matrix
45 Identity[
// C++ program to print Identity Matrix
47
Yes49
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______51
// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
53// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Identity[
4_______575_______51 // C++ program to print Identity Matrix
60// C++ program to print Identity Matrix
51 // C++ program to print Identity Matrix
62// C++ program to print Identity Matrix
47// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
51// C++ program to print Identity Matrix
661 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Identity[
4// C++ program to print Identity Matrix
53 // C++ program to print Identity Matrix
60// C++ program to print Identity Matrix
53 // C++ program to print Identity Matrix
62// C++ program to print Identity Matrix
47// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
53// C++ program to print Identity Matrix
66Yes2______3_______2
Yes7
Yes7_______575_______84
Yes7_______575_______86
Yes7_______575_______0
Identity[
4_______575_______51 // C++ program to print Identity Matrix
91// C++ program to print Identity Matrix
53Yes49
Yes7_______575_______95
// C++ program to print Identity Matrix
96// C++ program to print Identity Matrix
4// C++ program to print Identity Matrix
5Yes7_______575_______7
Yes7_______575_______95
#include
03// C++ program to print Identity Matrix
4// C++ program to print Identity Matrix
5Yes2____576_______3
Yes2_______575_______95____3_______09
// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______21
#include
221 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______39
#include
211 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
#include
27
#include
28
Javascript
#include
29
#include
30
#include
31____575_______45 #include
33
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______36
#include
371 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______36
#include
40#include
41
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Yes4
Yes2______3_______2
Yes7_______13_______8
Yes7_______575_______0
// C++ program to print Identity Matrix
1// C++ program to print Identity Matrix
2_______576_______58// C++ program to print Identity Matrix
4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes7_______575_______7
// C++ program to print Identity Matrix
2_______576_______64____575_______4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes2____576_______3
Yes2_______576_______70
#include
71 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 170
#include
731 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
#include
81
using
2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 193_______577_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______578_______0
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______89
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
#include
91
Đầu ra
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
Thời gian phức tạp. O[hàng x cột]
Không gian phụ trợ. O[1], vì không sử dụng thêm dung lượng
Chương trình kiểm tra xem một ma trận vuông đã cho có phải là Ma trận đồng nhất không.
C++
#include
92
#include
93
using
namespace
std;
#include
97 int
#include
99
using
00 using
01int
using
03int
using
05
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Identity[
4int
using
111 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Identity[
4int
using
18Yes2______3_______2
Yes7_______575_______0
using
23// C++ program to print Identity Matrix
2_______576_______9 using
26// C++ program to print Identity Matrix
5
Yes7_______575_______7
// C++ program to print Identity Matrix
0 using
31// C++ program to print Identity Matrix
2_______576_______9 using
26// C++ program to print Identity Matrix
5
Yes2____576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
42// C++ program to print Identity Matrix
5#include
3
using
2
int
using
4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
using
511 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
using
541 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167
using
561 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167
using
581 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167
using
601 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______0
using
63using
64____577_______65using
66_______575_______5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______7
using
64____577_______65using
72// C++ program to print Identity Matrix
5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
C
using
78
using
79
using
80
int
using
82____580_______ using
84int
using
05
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Identity[
4int
using
92Yes2_______3_______8
Identity[
4int
using
97Yes7_______575_______0
namespace
00// C++ program to print Identity Matrix
2_______576_______9 using
0
Yes7_______575_______7
// C++ program to print Identity Matrix
0 namespace
07// C++ program to print Identity Matrix
2_______576_______9 using
0
Yes2____576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
namespace
17#include
3
int
using
4
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______578_______23
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
using
511 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
namespace
29namespace
30____578_______31
namespace
30____578_______33
namespace
30namespace
35
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______0
namespace
38Yes2_______581_______3_______581_______4
namespace
421 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______7
Yes2_______581_______3_______581_______4
namespace
491 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
0#include
3
namespace
55
Java
namespace
56
namespace
57
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 131
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 132
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 133
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 134
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______580_______
namespace
65_______578_______66// C++ program to print Identity Matrix
5namespace
68
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______37
namespace
71 using
01int
namespace
74int
using
051 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Identity[
4int
namespace
831 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
namespace
85Yes2______3_______2
Yes7_______3_______8
Identity[
4int
namespace
921 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
namespace
94Yes7_______3_______2
// C++ program to print Identity Matrix
2_______575_______0 namespace
99
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
Yes49
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______576_______9
using
26// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
2_______575_______7 // C++ program to print Identity Matrix
0 std;
09
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
Yes49
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______576_______9
using
26// C++ program to print Identity Matrix
5Yes7_______576_______3
Yes2____576_______3
Yes2_______576_______9
using
42// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 193
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______97
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 137
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 199
Yes00
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
std;
38std;
39// C++ program to print Identity Matrix
5Yes2_______580_______
std;
43_______3_______69std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
51std;
52_______3_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
51std;
52_______3_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
51std;
52_______3_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151_______579_______45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
std;
81Yes2
Yes2_______575_______0
using
63std;
86_______579_______87using
66
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes2____575_______7
std;
86_______579_______87using
72____3_______10
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
#include
3
std;
99
Python3
int
00
int
01
int
02
Yes39
namespace
66// C++ program to print Identity Matrix
5Yes16
int
071 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Yes20
Yes21
Yes22
int
13Yes2_______3_______8
Yes28
Yes21
Yes22
int
13Yes7_______575_______0
Yes38
Yes39
Yes39
Yes28
int
26// C++ program to print Identity Matrix
2_______580_______28
Yes39
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
int
31// C++ program to print Identity Matrix
2_______576_______9 int
34// C++ program to print Identity Matrix
5
Yes7_______580_______37
int
38Yes39
Yes28
int
26int
42____580_______28
Yes39
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
int
31// C++ program to print Identity Matrix
2_______576_______9 int
34// C++ program to print Identity Matrix
5
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
int
53// C++ program to print Identity Matrix
5
int
55
int
56_______13_______39 std;
39// C++ program to print Identity Matrix
5
int
60_______13_______39 int
62_______3_______69std;
45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
int
70using
64int
72_______3_______51std;
45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
int
70using
64int
72_______3_______51std;
45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
int
70using
64int
72_______3_______51_______579_______45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 151
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 169
Identity[
00// C++ program to print Identity Matrix
0 Identity[
02
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______13_______43____581_______4
using
661 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
// C++ program to print Identity Matrix
7____13_______52
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______13_______43____581_______4
using
721 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Identity[
15
Identity[
16
C#
Identity[
17
namespace
57
using
Yes71
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 133
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 134
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______581_______25
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______37
using
00 using
01int
Identity[
31int
using
051 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Identity[
4int
using
11Yes2______3_______2
Yes7_______3_______8
Identity[
4int
using
18Yes7_______3_______2
// C++ program to print Identity Matrix
2_______575_______0 Identity[
52
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______576_______9
using
26// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
2_______575_______7 // C++ program to print Identity Matrix
0 Identity[
60
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 167_______576_______9
using
26// C++ program to print Identity Matrix
5Yes7_______576_______3
Yes2____576_______3
Yes2_______576_______9
using
42// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______97
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 137
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 199
// C++ program to print Identity Matrix
301 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______580_______
using
51Yes2_______580_______
Identity[
90Identity[
91____577_______56
Identity[
91____577_______58
Identity[
91____577_______60
Yes2
Yes2_______575_______0
using
63Yes2_______3_______002____577_______66
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
Yes2____575_______7
Yes2_______3_______002____577_______72
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
#include
3
// C++ program to print Identity Matrix
41
PHP
// C++ program to print Identity Matrix
42
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1016
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1017
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1018
// C++ program to print Identity Matrix
45 using
01
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1021_______579_______45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1023
Yes49
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
Identity[
4_______575_______51 // C++ program to print Identity Matrix
60// C++ program to print Identity Matrix
51 // C++ program to print Identity Matrix
621 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1023
// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
51// C++ program to print Identity Matrix
661 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
Identity[
4// C++ program to print Identity Matrix
53 // C++ program to print Identity Matrix
60// C++ program to print Identity Matrix
53 // C++ program to print Identity Matrix
621 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1023
// C++ program to print Identity Matrix
5// C++ program to print Identity Matrix
53// C++ program to print Identity Matrix
66Yes2______3_______2
Yes7_______575_______0
Identity[
4_______575_______51 // C++ program to print Identity Matrix
91// C++ program to print Identity Matrix
53 int
26// C++ program to print Identity Matrix
2_______3_______021int
72// C++ program to print Identity Matrix
51
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1063
// C++ program to print Identity Matrix
531 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1065
// C++ program to print Identity Matrix
2_______576_______9
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1068
Yes7_______575_______7
// C++ program to print Identity Matrix
0 Identity[
4// C++ program to print Identity Matrix
51 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1074
// C++ program to print Identity Matrix
53 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1076
namespace
30
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1021_______580_______72
// C++ program to print Identity Matrix
511 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1063
// C++ program to print Identity Matrix
531 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1083
// C++ program to print Identity Matrix
2_______576_______9
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1068
Yes2____576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1093
#include
3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______577_______2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______023
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1099
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______021
Yes39
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1103
Identity[
41 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1103_______3_______106
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1107_______3_______103
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1109
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1107______3_______103
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1112
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1107______3_______103
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1115
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______0
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1118_______3_______021
std;
451 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1023_______3_______122
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______95
using
66// C++ program to print Identity Matrix
51 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______7
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______575_______95
using
72// C++ program to print Identity Matrix
5
#include
27
#include
28
Javascript
#include
29
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1136
namespace
57
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1138
// C++ program to print Identity Matrix
45
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1140
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 12
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1144
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______3_______2
Yes2_______3_______8
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1149
Yes2______3_______2
Yes7_______575_______0
using
23// C++ program to print Identity Matrix
2_______576_______9 using
26// C++ program to print Identity Matrix
5
Yes7_______575_______7
// C++ program to print Identity Matrix
0 using
31// C++ program to print Identity Matrix
2_______576_______9 using
26// C++ program to print Identity Matrix
5
Yes2____576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______3
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______9
using
42// C++ program to print Identity Matrix
5#include
3
using
2
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1177
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1178
Yes7_______3_______180
Yes7_______3_______182
Yes7______3_______184
namespace
68
// C++ program to print Identity Matrix
0 using
63
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______70
using
661 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
// C++ program to print Identity Matrix
7
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13_______576_______70
using
721 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 110
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 13
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1198
#include
91
Đầu ra
Yes
Thời gian phức tạp. O[hàng x cột]
Không gian phụ trợ. O[1], vì không sử dụng thêm dung lượng
Bài viết này được đóng góp bởi Aarti_Rathi. Vui lòng viết bình luận nếu bạn thấy bất cứ điều gì không chính xác hoặc bạn muốn chia sẻ thêm thông tin về chủ đề thảo luận ở trên.