Questions tagged [triangular]

Use this tag when you have a programmatic problem related to coordinates, area, or any other property of a shape that forms a triangle.

The shape formed by a polygon which has three sides is said to be triangular in nature.

Triangular shape has been discussed, analyzed, formed mathematical formulas around, explained in different contexts since the inception of the idea of geometry.

You can read more about triangular shape and it's properties here.

157 questions
0
votes
3 answers

how to implement tent activation function in pytorch?

I need to create tent activation function as it is shown in the following image. I was wondering if there is torch built-in tent activation function? If not, is there any way to create this activation function? Thanks
user1538653
  • 121
  • 1
  • 1
  • 10
0
votes
2 answers

How to move up the values of each column in a matrix in R

I'm looking for a general way to do the following, I have a triangular matrix of nxn, for example: a NA NA b d NA c e f and convert it in: a d f b e NA c NA NA The idea is: for each column move the values, until the first non-NA value is in the…
Beth
  • 127
  • 6
0
votes
1 answer

interpolate data to triangular mesh

There are a lot of questions (and answers) available for people interpolating unstructured data to structured output. solutions to which include mesh grid or bivariate splines. However I'm looking for the inverse. How do I interpolate structured…
SBFRF
  • 167
  • 2
  • 16
0
votes
0 answers

How to form a triangle flocking formation?

I am using MATLAB to simulate a formation control of multi-agent systems. Currently I am using the flocking algorithm and have managed to simulate a circular flock. How can I simulate the agents to form a triangular flock? The agents will converge…
Jaren
  • 1
  • 3
0
votes
1 answer

I'm looking for a Python module or codes to permutate an asymmetric matrix into triangular form

I have an asymmetric matrix. A B C D A 0 0 1 0 B 1 0 0 1 C 0 0 0 0 D 1 1 1 0 I'm trying to switch rows and columns to make it into triangular form. Like: C A D B C 0 1 1 0 A 0 0 1 …
Zhentao
  • 140
  • 1
  • 10
0
votes
1 answer

Proper implementation of triangular solver for sparse matrix with OpenACC

I'm currently implementing triangular solver for sparse matrix and I've try to accelerate then using OpenACC directives. Given my matrix factors LU in sparse CSR format, OpenACC have managed to solve the L factor properly but the U factor gives…
0
votes
1 answer

How to store triangular (upper/lower) matrix into a single file using mpi with parallel hdf5?

I have a 1 million x 1 million double floating point matrix (table) that want to store in a single hdf5 file, the matrix itself is symmetric therefore only lower/upper triangle is needed, the code that write this matrix is an mpi code, so each mpi…
Roy Li
  • 51
  • 9
0
votes
1 answer

Show 2D celldata fields in 3D domains with Paraview

I have a .vtu file composed of tetrahedral and triangular elements (located on an outer surface). I also have a celldata field (for example, nrc1) defined on the triangular elements and being zero in the tetrahedral ones. When I select to plot this…
franpena
  • 151
  • 11
0
votes
1 answer

Switch triangular matrix

Is there an easy way to turn around a triangular matrix. import numpy as np shape=(4,8) x3=np.ones(shape) for m in range(len(x3)): step = (m * int(2)+1) #per step of 2 zeros for n in range(int(step), len(x3[m])): x3[m][n] =…
Jellyse
  • 839
  • 7
  • 22
0
votes
1 answer

How do I select a trigonal sector of a hexagonal Brillouin zone in python?

I am trying to select a trigonal region around the k point of the hexagonal Brillouin of graphene. I tried in this way: import random import numpy as np def trisample(A, B, C): r1 = float(random.random()) r2 = float(random.random()) s1…
0
votes
2 answers

How do I center the numbers for this C triangular number generator?

My assignment is to print out a triangular number's digits leading up to the final value in pyramid shape, but I can't for the life of me get it evenly spaced and centered, and I can't just use %6i or something because it has to work for any number…
Julian
  • 3
  • 2
0
votes
1 answer

Direction of angle after reflection

Say if I had a triangle and I was to draw a line towards one of the sides of the triangle, how would I create the reflected line of when that line hits the side of the triangle in Maple. I just drew this quickly in paints (and so its not…
Jerry
  • 29
  • 5
0
votes
1 answer

Print lower triangular packed matrix in Fortran 77

I have a matrix of real*8 numbers saved in an array as a packed lower triangular matrix: |1 * * * * *| |2 7 * * * *| |3 8 12 * * *| |4 9 13 16 * *| => [1,2,3,4,5,6,7,8,9...21] |5 10 14 17 19 *| |6 11 15 18 …
user3671704
  • 161
  • 7
0
votes
1 answer

Bash: nested loop one way comparison

I have one queston about nested loop with bash. I have an input files with one file name per line (full path) I read this file and then i make a nest loop: for i in $filelines ; do echo $i for j in $filelines ; do ./program $i…
Olorin.G
  • 37
  • 7
0
votes
1 answer

Custom button designs using XML Android Studio

I tried a lot of things but could not able to achieve what i want? here are the button designs that I wanted to create using XML in Android so that I can easily support it for Multi Screen. Design 1 Design 2