Questions tagged [vector]

A vector is a single-dimensional array: it contains components that can be accessed using an integral index. In some languages the size of a vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created. Use 'vector-graphics' for graphic display.

Filter by
Sorted by
Tagged with
-2 votes
0 answers
44 views

Segmentation Fault on certain compilers. CPP program

In a uni programming course i was asked to write a program that takes multiple lines of text as input, and has to morph it in lines of 60 characters (including spaces)This is the program I came up ...
0xStefanos's user avatar
-1 votes
2 answers
75 views

Store a number of one digit in a vector of char using sprintf

c[100] is a vector of char and x is a number between 1 and 9 How can I store x in a given position (n) in c What I tried is: sprintf(c[n], "%d", x); but it does not work If I write: sprintf(...
Didi's user avatar
  • 59
-4 votes
0 answers
32 views

Why is this not moving my character up/down on the Z axis? [closed]

Moving forward and backwards while Character State is Not Climbing works normally. Once I set Character State to Climbing my forward/backwards stops working and my character doesn't go up or down. ...
birchwoody's user avatar
0 votes
1 answer
19 views

How do i convert world direction to local direction?

I have the world positions of two objects (A and B) and the rotation of A. How do i calculate the local direction from A to B from the perspective of A? Position = x, y, z Rotation = x, y, z, w I ...
John Blayos's user avatar
0 votes
1 answer
74 views

How to remove duplicates in std::vector of user defined class?

I have a list of Text Editors that is to be rendered on the application whenever the user selected a file. It works well however when I started to delete elements on the list to signify that they were ...
Ron3545's user avatar
  • 13
-3 votes
0 answers
48 views

How to erase elements in a vector<vector<Point>> with a certain value? [closed]

How can I erase elements in a vector<vector<Point>> generated by OpenCV as coordinates points? I'm using OpenCV with findcontours, this gives me the coordinates for the external contours, ...
Luis Piñón's user avatar
0 votes
0 answers
33 views

Max Frequency od Azure Cognitive Search API Calls: document ingestion

I have this function that calls MergeOrUpload on the IndexDocumentBatch and then IndexDocumentsAsync. I am constructing the batch with the documents as they become available, which can be rather ...
Leon's user avatar
  • 317
1 vote
1 answer
76 views

How to store both integers and strings in a vector? [duplicate]

I need to store elements in a contiguous container like std::vector. The problem is the container needs to support insertion or both int and std::string. This seems to be difficult to do in C++ since ...
roulette01's user avatar
  • 2,064
3 votes
1 answer
22 views

How to pour values from a R vector into a list object without regarding the list structure including the levels of nesting and names used in the list?

Suppose we have a raw list object list_tmp, with varying levels of nesting, that looks like the below (at the bottom of the post is code for list_tmp.): > list_tmp $clinic $clinic$trial $clinic$...
Village.Idyot's user avatar
0 votes
0 answers
20 views

estimating eblupfh model: Error in median.default(vardir) : need numeric data

When I am running syntax error masseage is shown "Error in median.default(vardir) : need numeric data" Syntax: library(sae) eblupFH <- eblupFH(formula = income ~ urbanC + RuralC + ...
giorgi mikeladze's user avatar
1 vote
1 answer
63 views

Overloading the indirection operator to match the subscript operator?

I am attempting to write a class that behaves similarly to std::set - in that the elements are all unique, and adding an element already in the set doesn't do anything - but, where the elements in the ...
tomysshadow's user avatar
-1 votes
0 answers
42 views

Small program outputting extremely large numbers

Homework problem, I have to count all the instances of a certain subsequence of 3 distinct symbols in a grid such that, being ij the coordinates of the symbols in question, i<sub>1</sub> &...
iTesta's user avatar
  • 1
-1 votes
0 answers
38 views

Create an array from a struct and update it with user input in a function C++?

I need to use the struct Reservation to create a reservation. This is supposed to be arrays (C-style....but using C++..not sure on all the lingo yet) and not use vectors (or anything useful) as ...
Kat Trinity's user avatar
0 votes
0 answers
17 views

How to properly interpolate between N-Dimensions in Simulink involving vector fields

In MATLAB, I am trying to input a combination of currents (ex."5A, 5A, 5A, 5A") that range from -15A to 15A. The output should be a 3D vector field that shows the magnetic flux density, B, ...
Kyle Luna's user avatar
0 votes
1 answer
26 views

R function returns only 1 output instead of list of outputs (with no error message)

I was not able to find a solution to this exact problem so would appreciate any and all help! I am writing the following function: SS_function_cl = function(MDE, variance, variance_endline, k, ...
Diana Horvath's user avatar
0 votes
2 answers
60 views

Python: Get Vector 3 direction from a Vector 3 rotation, eg: `0 0 45` = '0.5 0.5 0'

I'm working on a Python program where I define my own vector 3D type. At least the way I imagined it, vectors can store both a position and rotation... if implementing quaternion rotations with 4 ...
MirceaKitsune's user avatar
0 votes
0 answers
36 views

Vector of non-iterable items in Rust [duplicate]

Consider the following code: let mut centroids: Vec<(f64, f64)> = Vec::new(); centroids.extend((90.0, 0.0)); It produces error 277: error[E0277]: `({float}, {float})` is not an iterator ...
Luís de Sousa's user avatar
0 votes
2 answers
53 views

How to make a Vector2 Direction to became a Vector3 Direction along Binormal or whatever it calls?

Currently i have a 2D Vector2 Direction, if i cast it to (Vector3)Direction, it would be a direction vector rotate alone V3.forward if i am not wrong right? I've already successfully got all 3 vectors,...
SoMuch SMx's user avatar
0 votes
0 answers
12 views

Standardizing The Exporter Names and The Total Amount With Various Specific Code by Using Loop in R

I have the variety of exporter name in data1 as input. Some of the exporter name have different spelling but represent the same company. Each company was classified in specific code. So, I need to ...
Nur Husnina's user avatar
-3 votes
0 answers
34 views

How do get an element which matches a condition to go at the front, back, forward by 1 or backwards by 1 [closed]

How do get an element which matches a condition to go at the front, back, forward by 1 or backwards by 1? I have tried to create a function for pushing it to the front and to the back and forward and ...
CherryDev86's user avatar
0 votes
1 answer
38 views

How do I convert a 2D column vector to a 1D vector in python for a pearsonr calculation in python?

I am fairly new to working with python and am struggling a bit on this. In this code I have defined xhand to be collected data of a hand moving horizontally and xpred to be a prediction of the hand ...
lms2234's user avatar
0 votes
1 answer
78 views

A vector of objects is not being populated

I've created multiple classes and each on them hold a vector of objects. Essentially, when I try to add the vector<Controller> to the StorageConnection object it shows that storageConnection ...
Jonathan007's user avatar
0 votes
0 answers
55 views

Pushing elements to vector where elements should have a specific lifetime

I am trying to append a formatted string as bytes to the headers field. But I keep getting compilations errors regarding lifetimes. pub struct Response<'a> { status_line: &'a [u8], ...
Hackerman's user avatar
0 votes
2 answers
74 views

Extract "values" from VectorUDT sparse vector in pyspark

I have a pyspark dataframe with 2 vector columns. When I show the dataframe in my notebook, it prints each vector like this: {"vectorType": "sparse", "length": 262144, &...
S.S.'s user avatar
  • 706
4 votes
2 answers
79 views

Number of different elements up to this point

I've got a relatively simple problem (I think) and I want to solve it in a fast and efficient way. I want to count the number of different elements in a vector up to each point in this vector. For ...
swolf's user avatar
  • 1,072
1 vote
2 answers
65 views

Create a named list, with the values as a character vector

I am trying to create a named list in R where the contents of each named list element is a character vector of two values. What I have is like this: list_vec <- c('item1', 'item2', 'item3') val_vec ...
Jon77's user avatar
  • 13
0 votes
1 answer
25 views

For df in vector creates vector, but I want a dataframe

I am using for dfx in MyDFvector to create a variable, but it is returning Vector[Vector] but I want just a DataFrame. Any help? recreate minimal problem using DataFrames # create some DataFrames ...
donPablo's user avatar
  • 1,939
0 votes
1 answer
40 views

Which algorithm is more accurate for calculation of the angle between 3D vectors?

Over the years I've came across a few algorithms to calculate the angle between two 3D vectors. As the image shows I've discarded acos and asin ones for their corner case issues. I'm now down to two ...
probiner's user avatar
0 votes
1 answer
65 views

how to combine files and vector of class type? cpp

create the class Student h which will have the following characteristics: ● AM: (int) ● Name: (char *) ● Semester: (int) ● Active?: (bool) Write a function that creates and returns a collection of ...
ghghghg's user avatar
0 votes
0 answers
75 views

Dynamic 2D arrays into vector C++

I am wondering is it possible to insert 2D dynamic array into vector in c++. If it is possible then how can I implement it? I've been trying to do it but it keeps showing me wrong results, looks like ...
Dante's user avatar
  • 11
-8 votes
0 answers
78 views

Dynamic double array into vector C++ [closed]

I want to put dynamic double array into vector but I am receiving wrong results Vector declaration: vector<double**> vectordx; putting array into vector: vectordx.push_back(valXY.dx); array ...
MonkeyWith Coconut's user avatar
0 votes
1 answer
168 views

Want to make a function return a vector of arrays in C++

I have made a function that returns a vector of unknown length containing arrays of 64 integers. When I access the vector inside the function, I am able to access the arrays properly. However, when I ...
Random coder's user avatar
0 votes
1 answer
33 views

How to make blob represenation of a vector to Redis vector search (PHP)?

i've got vector [-0.00047102556, -0.0066432534, -0.029728396, ...] Redis whats it to blob representation like \x12\xa9\xf5\x6c How it can be done in PHP? For python we have such solution function ...
Kot Murzik's user avatar
0 votes
0 answers
6 views

Finding the Index of an Element in a Vector using R

I'm working with R and I have a vector, let's call it "my_vector", containing various elements. I need to find the index of a specific element within this vector. Is there a built-in ...
Khushi Tripathi's user avatar
1 vote
1 answer
67 views

Ray bouncing: How to invert a velocity vector to represent a perfect bounce?

I'm working on a voxel raytracing system in JavaScript, which odd as it may sound is quite doable in a simple form. I'm trying to figure out how to make a virtual ray bounce and can't quite wrap my ...
MirceaKitsune's user avatar
0 votes
0 answers
7 views

Generate N vectors of dimension D with average cosine similarity of Theta

I am trying to figure out a way to generate vectors that have some average cosine similarity with each other. From another question, I found how I can do this for a single vector. But I want the ...
statsman's user avatar
0 votes
0 answers
11 views

How to setup SDK configuration without running python -m anki_vector.configure

I have setup wire-pod and my vector however when I try to run a custom intent pointing to a custom script, I get the following error: raise VectorConfigurationExCould not find the sdk configuration ...
Mohammad Anwar's user avatar
0 votes
0 answers
29 views

C: realloc(): invalid next size when reallocating vector

I'm implementing a dynamic unsigned array struct (equivalent to C++ std::vector) and I'm facing some issues when reallocating for push_back. Here is the relevant code: #include <stdio.h> #...
Caio Vinícius's user avatar
0 votes
1 answer
61 views

Class with vector of another class doesn't like to change its values [duplicate]

I have a class called intClass that contains a private vector of ints and functions to modify its contents. I have another class called intClassClass that contains a private vector of intClasses and ...
scutoid's user avatar
1 vote
0 answers
23 views

Generating unique vectors using randi

I want to randomly generate 6 vectors using randi, but I want to add specific parameters for what can be generated. First, I don't want any vectors to be duplicates. What can I add to make them unique?...
Michaela Schnell's user avatar
-1 votes
0 answers
16 views

Scrape Point data from a Leaflet Map of Bus Stops in Vancouver, Canada

Please help in retrieving lat long or geojson data or a KML file from the link https://tcomm.bustrainferry.com/ of all the points shown in the map. It is a public data, and also available as list data ...
Sanjay Mohan's user avatar
0 votes
0 answers
41 views

Wrapping up a vector to pointer parameters

I have a Model type that has double "parameters" and a vector of pointers to them, vector that I use for shifting up and back down the parameters to see how some member function depends on ...
11house's user avatar
  • 83
0 votes
0 answers
43 views

Summing the elements of a __m256i vector [duplicate]

I am looking to sum the elements contained in a __m256i vector and extract the result in a int in C. Basically, I am trying to achieve this, but using AVX: sum += key[l] + key[l + 1] + key[l + 2] + ...
UserBoy's user avatar
-1 votes
1 answer
132 views

std::vector of user-defined class constructs and destructs too many objects [duplicate]

I'm trying to use a std::vector to store multiple objects of a user-defined class. When I try to push them into the vector multiple unexpected calls to destructors happen, what's going on? Code: #...
nyedoardo's user avatar
-1 votes
0 answers
31 views

Decrypting: "EVP_CIPHER_CTX_set_key_length:invalid key length" sometimes and i dont know why

I send from Android InitialVector(iv) "testtesttesttest" and php decrypt the message right, but "testtesttestitot" give me error. "GWS3eDKYYoaZISBxbUINjvhreiiYHSAg";//...
ProgTerracom's user avatar
0 votes
1 answer
24 views

R: Applying function to single value in data.table 1 and comparing resulting individual values in vector with single values in data.table 2

I know how to apply a function to a column in data.table, receive a single value and compare within the same data.table. But, since I am a novice, I do not know how to compare the the result from the ...
Per's user avatar
  • 11
0 votes
1 answer
79 views

Unexpected angle value

I have a vector A with coordinates (-51.85,-2.38,-0.93). The normal vector at point A(lets call it Na) is (0,0,1). I want to calculate the angle between the position vector A and the normal vector Na. ...
Tariq Islam's user avatar
0 votes
2 answers
117 views

Does it makes sense to take vector<string_view> as a parameter

I want a function that takes as input a vector of strings that I don't want to modify. So I thought about taking as input a vector<string_view>. However, if I do this, I can't pass a vector<...
poipoi's user avatar
  • 126
0 votes
0 answers
48 views

How to access members of a List of DataFrames in Rcpp

I have an Rcpp function that includes a List of DataFrames as a parameter - let's call it "dflist." How would I access an element to read and/or assign to? And how would I return the ...
hishikatakanari's user avatar
0 votes
2 answers
77 views

How to reverse the levels of a numeric vector

I have a vector with 47 numeric objects, values of objects from 1 to 7. df$PS<- 2 3 7 4 5 3 7 3 7 3 1 6 3 6 3 3 1 5 1 3 3 1 3 2 3 5 3 5 4 4 2 1 4 3 5 3 2 4 4 3 7 3 6 4 1 6 2 I need to reverse ...
user22985482's user avatar

1
2 3 4 5
704