Tag：diagonal

Matrix eigenvectors and eigenvalues
Recently, when learning LDA, we need to calculate eigenvalues and eigenvectors, so we re learned a wave The calculation of eigenvalues is relatively simple in Python, and the linalg calculation of numpy needs to be imported.Linalg is the abbreviation of linear algebra. Import numpy first import numpy as np Randomly generate a matrix A A […]

100 examples of C programming (29): Latin square
Example 29 Latin square Problem description A Latin square matrix of order NxN is constructed so that the numbers 1 to N in each row and column of the square matrix appear only once. If n = 4: 1 2 3 4 2 3 4 1 3 4 1 2 4 1 2 3 […]

Diagonal elements of matrix and
Here’s a square matrixmatPlease return the sum of the diagonal elements of the matrix. Please return the sum of the elements on the main diagonal of the matrix and the elements on the sub diagonal and not on the main diagonal. (if the order is odd, the elements of the diagonal intersection will only be […]

Exercise 73 judging upper triangular matrix
The upper triangular matrix refers to the matrix whose elements below the main diagonal are all 0; the main diagonal is the line from the upper left corner to the lower right corner of the matrix. This problem requires the preparation of procedures to determine whether a given square matrix is a triangular matrix. Input […]

The difference between SP, DP and PX in layout file
preface: As we all know, there are many Android manufacturers, and Android phones and tablets of various sizes emerge in an endless stream. The fragmentation of Android ecological environment is becoming more and more serious. In order to solve the problem of excessive resolution, Google defines Px, DP and SP in the Android development document, […]

Multi scale neural network based on hierarchical matrix
Paper: a multiscale neural network based on hierarchical matricesAuthors: Yuwei fan *, Lin Liny, lexing yingz, Leonardo zepedan’u ~ nezxThe main work of this paper is to introduce the idea of $/ mathcal {h} $matrix into neural network to solve nonlinear partial differential equations. The structure of the paper is as follows: firstly, the concept […]

C practical exercises 38
Title:Find the sum of diagonal elements of a 3 * 3 matrix Program analysis:Using double for loop control input twodimensional array, and then a [i] [i] accumulation output. example: #include #define N 3 int main() { int i,j,a[N][N],sum=0; Printf (“please input matrix (3 * 3): \ n”); for(i=0;i The output results of the above examples […]

Common indicators of semantic segmentation
There are three most commonly used indicators in semantic segmentation. To facilitate interpretation, the confusion matrix needs to be introduced first, as follows: Confusion matrix True value Positive Negative predicted value Positive True positive (TP) False positive (FP) Negative False negative (FN) True negative (TN) First of all, it is assumed that […]

Eight queens problem of classical algorithm
The eight queens problem is an old and famous problem, which is a classic case of learning backtracking algorithm. Let’s explore it together today! Back in 1848, international chess player Max Bethel raised such a question, Put eight queens on the 8 × 8 grid chess, so that they can’t attack each other, that is, […]