Questions tagged [symmetric]

is used in its general meaning, so you are encouraged to use one or more tags in addition to this tag, to describe your case better.

An example of Symmetric would be a Symmetric Key, which is used in both the sides of an algorithm in cryptography.

170 questions
5
votes
2 answers

Armadillo c++: Is there a specific way for creating efficiently triangular or symmetric matrix

I am using armadillo mostly for symmetric and triangular matrices. I wanted to be efficient in terms of memory storage. However, it seems there is no other way than to create a new mat and fill with zeros(for triangular) or with duplicates(for…
user2638923
  • 51
  • 1
  • 3
4
votes
2 answers

Create a symmetric matrix from circular shifts of a vector

I'm struggling with the creation of a symmetric matrix. Let's say a vector v <- c(1,2,3) I want to create a matrix like this: matrix(ncol = 3, nrow = 3, c(1,2,3,2,3,1,3,1,2), byrow = FALSE) [,1] [,2] [,3] [1,] 1 2 3 [2,] 2 3 …
noriega
  • 447
  • 1
  • 9
  • 23
4
votes
0 answers

Should autoencoders be symmetric?

I always find myself wanting to make the decoder side of an autoencoder as symmetric as possible with respect to the encoder side, because it feels like an "elegant" design decision. But I suspect that it's not optimal. And I'm not finding any…
4
votes
1 answer

Generate a random symmetric tensor in python

I want to generate a random (gaussian) tensor symmetric with respect to all the permutations of the axes. In the end I want all the entries with the same distribution, so tricks like summing over all the permutation and rescaling by sqrt(k!), where…
sstev3
  • 53
  • 5
4
votes
4 answers

Rect::contains(Point) or Point::is_inside(Rect)

Should an API provide Rect::contains(Point) or Point::is_inside(Rect) or both? or Math::contains(Point, Rect) cause it's symmetric? The same Q goes for LineSegment::contains(Point), Rect::fully_contains(Circle) etc.
Iraimbilanja
4
votes
1 answer

R Speed up vectorize for square matrix

Anyone able to help me speed up some code: n = seq_len(ncol(mat)) # seq 1 to ncol(mat) sym.pr<-outer(n,n,Vectorize(function(a,b) { return(adf.test(LinReg(mat[,c(a,b)]),k=0,alternative="stationary")$p.value) })) Where mat is an NxM matrix of N…
Travis Liew
  • 787
  • 1
  • 11
  • 34
4
votes
1 answer

Complex symmetric matrices in python

I am trying to diagonalise a complex symmetric matrix in python. I had a look at numpy and scipy linalg routines but they all seem to deal with either hermitian or real symmetric matrices. What I am looking for is some way of obtaining the Takagi…
purpleshift
  • 170
  • 1
  • 7
3
votes
3 answers

Prolog — symmetrical predicates

I have to simulate family tree in prolog. And i have problem of symetrical predicates. Facts: parent(x,y). male(x). female(y). age(x, number). Rules: blood_relation is giving me headache. this is what i have done: blood_relation(X,Y) :-…
shake
  • 323
  • 9
  • 23
3
votes
2 answers

symmetry matrix behavior on R 4.1

I want to test the symmetry of matrices in R 4.1.1. I have a dataframe and then I convert it to a matrix. The data type with class() function returns now both a "matrix" and an "array". The matrix is symmetric, but the function isSymmetric() returns…
peixe
  • 1,272
  • 3
  • 14
  • 31
3
votes
3 answers

R : convert a matrix to symmetric matrix with diagonal 0

I have a matrix as below; 1 2 3 4 5 1 0 1 1 0 0 2 0 0 1 1 0 3 1 0 0 0 1 4 0 0 1 0 0 5 0 1 0 0 0 I need to get symmetric matrix as follows with diagonal 0; 1 2 3 4 5 1 0 1 1 0 0 2 1 0 …
Anu
  • 211
  • 1
  • 9
3
votes
1 answer

Reshape 1xn + 1xn matrices to be a symmetric after summation

I have for example two matrices in dimension of 1x5, and I want to reshape them to be in a symmetric 5x5 matrix after doing c = a+b operation then adding the diag(c) <- 1 let's say for example: a <- matrix(seq(1,5), byrow = T) b <- matrix(seq(1,5),…
3
votes
1 answer

Find the percent of tokens shared by two documents with spacy

for nltk it would be something like: def symm_similarity(textA,textB): textA = set(word_tokenize(textA)) textB = set(word_tokenize(textB)) intersection = len(textA.intersection(textB)) difference =…
negfrequency
  • 1,801
  • 3
  • 18
  • 30
3
votes
1 answer

Error in R function `is.positive.definite`

I want to test whether a matrix is positive definite or not in R. I used the R function is.positive.definite but kept getting the following error message although my matrix is symmetric as function isSymmetric shows. Is this because of rounding…
LaTeXFan
  • 1,136
  • 4
  • 14
  • 36
3
votes
1 answer

Python Pandas - "1D" file to 2D array

I saw an answer to a question on converting a nested "2D" dictionary to a Pandas DataFrame. That would be a solution to my problem, but then I was wondering, whether I can the skip the intermediate step of generating a nested dictionary. Let's say…
tommy.carstensen
  • 8,962
  • 15
  • 65
  • 108
3
votes
1 answer

Should I Allow Asymmetric Equals?

I have a C# type for which it makes logical sense to compare for equality with int. Call this type Number. However, I can't make Equals symmetric, because I can't change Int32.Equals(object other). So, should I permit the asymmetric equality, like…
Xenoprimate
  • 7,691
  • 15
  • 58
  • 95
1
2
3
11 12