Questions tagged [vector]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

Describing a vector field

I am currently making use of a 2D vector field that I would like to be able to describe and characterize. I thought of a few metrics that I could use, but they seem limited for both a qualitative and ...
user avatar
  • 101
10 votes
2 answers
501 views

FEM for vector valued problems: reference request

I'm a PhD working in a computational mechanics lab. I come from a Math department, and I have a good background for what concerns the basics of finite elements, like inf-sup conditions, DG, non-...
user avatar
0 votes
1 answer
81 views

In Lanczos algorithm, can we choose the staring vector to be the first eigenvector of the input matrix A?

In Lanczos algorithm, can we choose the staring vector $v$ to be the first eigenvector of the input matrix $A$? How can we select it? and why $v$ need to have norm 1?
user avatar
  • 1
1 vote
1 answer
81 views

k nearest neighbors dictionary for vectors?

Does there exists a data structure with these properties Stores vectors in a dictionary When given a key that is also a vector, returns the k nearest vectors using a similarity metric (e.g. Euclidean,...
user avatar
4 votes
1 answer
304 views

Algorithm to merge two polygons (using connectivities)?

I am struggling with implementing an algorithm that does one simple thing: Consider two polygons (one can just draw any two polygons and number their vertices), whose connectivities in a node list are:...
user avatar
  • 145
2 votes
1 answer
38 views

In Eigen, can a sparse matrix contain vectors/objects instead of simple scalar values?

I need to have a sparse matrix whose elements are not simple numbers, but objects, e.g. a couple of floating point values and a bunch of integer indices. I am wondering if Eigen has something similar, ...
user avatar
  • 161
2 votes
0 answers
99 views

If dot product is commutative, why does MATLAB give different answers?

Why does the dot() function in MATLAB return different expressions based on the order in which I pass vectors?
user avatar
  • 121
2 votes
0 answers
127 views

Lexicographically order matrix into a vector

I am trying to implement the algorithm contained in this article here. It is about solving a 2 and 2.5D Fredholm integral, focused on bidimensional NMR experiments. I've made significant progress, ...
user avatar
  • 149
0 votes
1 answer
294 views

Computing excited states using itensor (with DMRG)

I am trying to compute first few excited states of some Hamiltonian (I am using itensor and its DMRG algorithm). To do so, I am ...
user avatar
1 vote
0 answers
47 views

How to integrate the contents of a vector using an adaptive quadrature routine [duplicate]

I have a function which requires the return type to be a container. The problem is that I need to integrate the contents of the container as efficiently as possible and was hoping to use adaptive ...
user avatar
  • 131
0 votes
1 answer
261 views

Solving Vectorial Poisson Equation in FENICS

I am trying to solve the following, "test problem" involving a vectorial Poisson equation: $$-\nabla^2 \vec{A}=\vec{J} \quad \forall x\in\Omega=[-1,1]^3$$ $$ \vec{A}=\vec{0} \quad \forall x\in\...
user avatar
2 votes
1 answer
697 views

Calculate xyz velocity vectors for circular orbit

I'm trying to calculate the xyz velocity vectors for a circular orbit given a set of position vectors, but I can't seem to get it right. The formula for obtaining the velocity magnitude is the ...
user avatar
4 votes
1 answer
342 views

Plotting or Visualizing a Higher dimensional vector field

I am trying to visualize a higher dimensional vector field. Is there a way to do this. I asked this question here, I was told to post it here. As an example, one can use $$\begin{eqnarray} \dot{x}...
user avatar
  • 141
2 votes
1 answer
74 views

Vector characterization of cylinder displacements in a box

We have a cylinder of length $l$ (in units of its radius $d,$ as basic unit of length set to $d=1.$) in a box, and we consider an orthonormal Cartesian coordinate system with its origin placed at the ...
user avatar
2 votes
1 answer
138 views

How to deal with numerical errors in electrostatic field calculations

I want to trace electrostatic field lines emerging from 2D surfaces in 3D space. Eventually I want to find their intersection with an (uncharged) mesh. The charge distribution $\sigma(x), x \in \...
user avatar
  • 587
4 votes
4 answers
579 views

Find representatives of vector-space in set of vectors?

Suppose I have a multi-dimensional vector space $X$, and a collection of $n$ vectors $\{x_i\}_{i=1}^n \subset X$, which are not evenly "spaced-out" in $X$. I am searching for $m<<n$ of these $...
user avatar
  • 143
5 votes
1 answer
3k views

How to compute the Helmholtz decomposition of 2D and 3D vector fields?

I have a sample of 100 particles with their 3D positions and velocities. I want to decompose the velocity vector field to its curl free and divergence free components. Is it a feasible to do so for ...
user avatar
  • 151
3 votes
1 answer
286 views

Software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically

Can somebody point me to software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically? There are a plethora of papers and documents describing how to do ...
user avatar
  • 141
0 votes
1 answer
2k views

two level iterators C++ [closed]

I am trying to implement a two level iterator as I will now describe. Basically I have a "vector of vectors" and I want a single iterator that will loop over all the objects in the vector of vectors. ...
user avatar
  • 193
0 votes
1 answer
92 views

Regarding solution vector of the wave equation

I am simulating the wave equation using FEM. For a 2D wave equation, when I visualise my output in Paraview, I see a separate solution in 'x' and 'y' direction for each node on the mesh. Therefore, if ...
user avatar
  • 347
1 vote
2 answers
729 views

Find a permutation matrix (using the Matlab's function $symrcm$) of a matrix $A(2:end, 2:end)$

I've the following Matlab code: r = symrcm(A(2:end, 2:end)); prcm = [1 r + 1]; spy(A(prcm, prcm)); where A should be sparse ...
user avatar
0 votes
1 answer
76 views

Efficiently approximating sum of 2-norms

Suppose I have a real vector $\bf x$ of length $KN$, where $K<<N$. Let's say I break this vector $\bf x$ up into $N$ vectors each of length $K$, $${\bf x}_1,...{\bf x}_n.$$ Now I would like ...
user avatar
  • 443
0 votes
2 answers
5k views

Plot vector field in matlab

I have the function of an electric dipole expressed in cartesian coordinates and I want to create the vector field using Matlab . The function is $$E_z= \frac{p}{4\pi\epsilon_0} \cdot \left(\...
user avatar
  • 1
5 votes
0 answers
570 views

Numerically calculating the divergence of a set of oriented points

Say I have a set of oriented points at locations $\vec{v_i}$ with each some direction $\vec{n_i}$, in practice they represent the normals of some surface that has been non uniformly sampled. How would ...
user avatar
  • 151
1 vote
2 answers
55 views

Arranging variable ranges into a cell MATLAB

I have the following simple code v=[]; for i=10:-1:1 for j=0:0.2:5 v(end+1)=i+j; end end min(v) It returns the minimum of vector $v$ whose length in this ...
user avatar
  • 47
0 votes
2 answers
192 views

Vector and index notation equivalence

Given 2 vectors $\mathbf{u}$ and $\mathbf{v}$ the following are equivalent: $\mathbf{u}\cdot\mathbf{v}$ $\mathbf{u}^T \mathbf{v}$ $u_i v_i$ $v_i u_i$ $\mathbf{v}\cdot\mathbf{u}$ $\mathbf{v}^T\...
user avatar
3 votes
1 answer
387 views

Sparse matrix vector product using PETSC

I am trying to do a simple parallel sparse matrix vector multiplications using PETSC. My sparse matrix is a simple tridiagonal laplacian matrix, which is distributed over multiple processors using ...
user avatar
0 votes
2 answers
659 views

Rotate 2D shape around origin in a 3D space

I have a 2D square ABCD in a 3D space, with side length 2s, that is represented by four vectors (one for each vertex) and a fifth vector ...
user avatar
  • 103
4 votes
2 answers
313 views

Direct Numerical Simulation of reacting flows

I need to write a DNS code for simulating reacting flows in turbulent conditions. The code has to be highly scalable, because the computational cost of simulations is expected very large. My idea is ...
user avatar
  • 41
0 votes
0 answers
421 views

3D animation of a vector field (ParaView) [duplicate]

I am trying to create an animation of a 3d vector field in ParaView. All my data is in three matrices (201 x 201 x 201) corresponding to vectors components in x,y,z directions. And it's calculated in ...
user avatar
1 vote
0 answers
488 views

Get a single value from a global Vec in petsc [closed]

I don't understand the concept with local and global vec's in petsc when it come to DMDAVecGetArray and VecGetValues. I'm creating some DMDA Vec in parallel which works well. Now I want to access ...
user avatar
  • 11
0 votes
1 answer
114 views

What is the best method to combine multiple vectored results into one chart?

Currently I am working on my research report where I've done a lot of measurements. For now I have uploaded everything into Matlab and visualise each on chart. Each one consists of 4 lines drawn with ...
user avatar
  • 101
6 votes
2 answers
4k views

How can one produce a proper streamline plot?

I recently had trouble producing a proper streamline plot in Mathematica, and apparently the problem is a good bit harder than I appreciated. I would like to know if there exist general algorithms to ...
user avatar
4 votes
1 answer
135 views

Reconciling vector and scalar notation

I am trying to derive Galerkin type weak formulation for the Stokes equations. I'm having a bit of a problem reconciling the notation in the integration by parts. I know that the answer I'm looking ...
user avatar
1 vote
0 answers
66 views

Understanding the use of Minimum Translation Vector (MTV) for an elastic collision response

So, I'm trying to simulate polygon rigid body physics, both linear and angular. To calculate the MTV is easy in SAT (Minimum Translation Vector), and to use it to adjust position is also easy: ...
user avatar
  • 139
1 vote
1 answer
95 views

Accurate dot-product of fields with only knowing normals

I am trying to accurately calculate $\vec{j} \cdot \vec{E}$ for an electron energy equation on a finite-volume mesh. $\vec{j}$ is the electron current density, and $\vec{E}$ is the electric field. ...
user avatar
  • 4,567
2 votes
1 answer
4k views

Angular Velocity by Vector - 2D

This is originally a problem in programming, but since almost no one on Stackoverflow know how to solve this I went here instead; https://stackoverflow.com/questions/23003612/javascript-angular-...
user avatar
  • 139
1 vote
1 answer
1k views

Coding complex equations into C++

I have here equations from a paper by E. Bradlow. They're for counting the events in a Weibull-distributed data set. $$\begin{align} \Pr(N(t)=n) &= \sum_{j=n}^\infty{\frac{(-1)^{j+n}(\lambda t^c)^...
user avatar
2 votes
1 answer
110 views

How can I efficiently position the different segments of a large vector in Eigen C++?

I have a very large(up to 9 000 000) VectorXi vector defined in Eigen C++ which is read from a data file. The vector consists of 0, 1, 2, ...n segments with ...
user avatar
2 votes
1 answer
141 views

combine $n$ vectors using $L2-normalization$

Suppose that I have the following vectors $v_1$, $v_2$, $v_3$ $\in R^n$,$n= 9$. What I want to do exactly is to combine these $3$ vectors into $1$ representative vector $V$. According to the ...
user avatar
  • 175
3 votes
1 answer
5k views

How to change the dimensions of an Eigen Matrix in a loop?

I have a while loop, in which I use a Matrix A, vectors B and x with varying dimensions: <...
user avatar
2 votes
1 answer
191 views

Numerically efficient way to compute sparse-matrix arithmetic on GPU?

Can anyone tell me some very good/efficient numerial algorthims for GPU/CUDA to compute multiplication/ between sparse matrices (its good if you can recommend me some research papers)? I googled ...
user avatar