291 Topics

Member Avatar for
Member Avatar for toritza

hello. I am quite new in python so i have a question. I have a csv file in which i have names of 30 cities and their coordinates(lat and long). i want to generate a distance matrix for these cities. How can i do this ?

Member Avatar for Gribouillis
0
2K
Member Avatar for 24x24

Ok, I have three main tasks. One: I need to create a 2 dimensional array that is 8x8 and consists of randomly generated numbers that range from 0-3. I'm assuming the Math.random will be used inside of a for loop with a limit set for length(8) and range(0-3) somehow? Two: …

Member Avatar for 24x24
0
257
Member Avatar for LexLieberthal

My friend needs a program that will: 1. Ask the user for the size of the matrix. The choices are 2x2 or 3x3. 2. Ask the user for the operation to perform. The choices are addition or subtraction. 3. Let the user input the numbers for the first matrix. 4. …

Member Avatar for LexLieberthal
-1
147
Member Avatar for Dasharnb777

Hi, everyone. I need to find matrix n*n (or 5*5) determinant. I have a function translated from Pascal, but there's INDEX OUT OF RANGE EXCEPTION. Could somebody help me? Here's my code: [CODE]public static double DET(double[,] a, int n) { int i, j, k; double det = 0; for (i …

Member Avatar for Dasharnb777
0
688
Member Avatar for Dasharnb777

Hi, I have a matrix. And I need to get 1D arrays from my matrix. For example, I have follow matrix: 123 456 789 So it looks like 3 [B]arrays[/B]: 147, 258, 369. But I got "Index out of range exception" in this code: [CODE] int[] b = new int[n]; …

Member Avatar for Dasharnb777
0
135
Member Avatar for blessed87

I have the following code: [CODE]for (int w=0; w<10; w++) { //some lines of code unsigned long num = x.to_ulong(); cout << "Decimal form is: " << num << endl; } [/CODE] Now what I want is, to make a matrix which will have these values of num, column wise. …

Member Avatar for djarn
0
179
Member Avatar for blessed87

[CODE]std::vector<std::vector<unsigned long> > matrix(15); // 15 rows typedef std::vector<std::vector<unsigned long> >::iterator it_type; it_type row = matrix.begin(); for (int w=0;w<10;w++) { //some lines of code unsigned long num = x.to_ulong(); cout <<"Decimal form is: " << num<< end; // if we've hit 15 items in the current row (i.e. 15 columns), …

Member Avatar for WaltP
0
203
Member Avatar for wantsree

Hi folks, I'm a beginner in c++. The other day was trying to multiply 2 matrices using friend function. The program did run ,but the result showed some garbage values. plz help.. #include<iostream.h> class matrix { int a[10][10],b[10][10],d[10][10],r,c,l,m; public: void read (void); void display (void); friend void multiply1 (matrix m1); …

Member Avatar for wantsree
0
1K
Member Avatar for comSysStudent

Hi all, I'm mostly into my Java so I'm not even sure if I gave the post a proper heading. Basically I'm trying to read two matrices from the command line and print them out. Reading works as far as I can tell but when my program tries to call …

Member Avatar for comSysStudent
0
219
Member Avatar for negneg

Hi Everyone, I am trying to compile a code and I keep getting error C2064: term does not evaluate to a function taking 1 arguments here is my code(actually I got it from a book),can anyone help me what is wrong? thanks Negin #include <iostream> #include <math.h> using namespace std; …

Member Avatar for negneg
0
203
Member Avatar for HeartBalloon

I have to write a code to build an array like this: 1,6 1,0 2,3 3,4 5,6 4,5 7,6 1,2 9,7 Where the numbers are coordinates which have to be "separated" when taken in consideration Like: cell[2][2]---> x=5 y=6 I decided to make a char array, so that with atoi() …

Member Avatar for HeartBalloon
0
110
Member Avatar for stroper

Hye everyone, I am trying to make a 2d-char array, fill it with random letters(chars) and print it. If I do it like this I get a ArrayIndexOutOfBoundsException: 0. I am a newbee. I import my prefs(width, height) from static getters in the class preferences. Can anyone help me please? …

Member Avatar for stroper
0
472
Member Avatar for sandwich88

hi everyone this is my first post and yes, im just starting with cpp im using devc++ so i have this homework which i could get done for its due date but still it would really help me to understand more about cpp if i could get it done but …

Member Avatar for sandwich88
0
135
Member Avatar for mjv89

Hi, Sorry for another thread. I'm trying to do matrix multiplication in Java now. Here's my code (that wont work). Please let me know if you spot anything that I should change... [code] class multiply { public static void main(String[] args) { int[][] a = {{1,2,3}, {1,2,3}, {1,2,3}}; int[][] b …

Member Avatar for jon.kiparsky
0
133
Member Avatar for JordanHam

int arr[]={4,5,6,8,1,6,4,7,1,2}; and I want and array to equal the ln of those values in an array? I dont why I am having so much trouble with this. Thanks!

Member Avatar for JordanHam
0
129
Member Avatar for vavazoom

I have a Matrix class and I am trying to overload the multiplication sign. It compiles without error and runs, however it does not display the matrix like it should. So I want to make sure the error is not in my overload operation. [CODE] public static Matrix operator *(Matrix …

Member Avatar for ddanbe
0
185
Member Avatar for vineeshvs

[code] #include <stdio.h> #include<stdlib.h> int **matrix_mul(int **m1,int **m,int a,int b,int c,int d); main() { int i,j,r1,r2,c1,c2,**p,**q; printf("Enter the number of rows and columns of first matrix :\t"); scanf("%d%d",&r1,&c1); printf("Enter the number of rows and columns of second matrix :\t"); scanf("%d%d",&r2,&c2); //memory allocation for m1 int **m1; m1 = malloc(r1 * …

Member Avatar for vineeshvs
0
159
Member Avatar for gyagyus

Hi! I try to implement a matrix template class which inherits the vector of vectors. The message I get: "error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const Vector<T> *' (or there is no acceptable conversion)" (When I call the alternate matrix constructor, …

Member Avatar for xth
0
3K
Member Avatar for OcarinaSensei
Member Avatar for masijade
0
574
Member Avatar for remo25

[CODE]#include <iostream> #include<cstdlib> #include<iomanip> using namespace std; int* userInput(int mat); void multiply(int mat, int* array); void print(int **mult, int **divides, int mat, int row, int col); //Main method, calls IO and handles the case for only 1 matrix. int main() { int mat = 0,i,j; int arrayA[mat][mat]; cout << "Enter …

Member Avatar for ravenous
0
594
Member Avatar for ninikobb

Hello everybody! Im a new to this site. I wonder how can I get the row dimension of a matrix. For example i have a matrix double[n,m] and i want to get n provided m is unknown. So what property of method should i use??? Thank you

Member Avatar for ddanbe
0
121
Member Avatar for sobi07

hello. i have been studying C++ and i programmed the following. can any one convert this in C language please it is urgent. [code] # include <iostream> # include <iomanip> # include <windows.h> #include <conio.h> using namespace std; void pw (int,int); void swap( double&,double&); void main() { double arr1[10][10],arr2[10][10],arr3[10][10],d,d1,d2,d3,X,Y,Z,x1,x2,x3; int …

Member Avatar for sobi07
0
111
Member Avatar for Castiel1631

I am trying to create an abstract data type for matrices. I have a function matrixInit to dynamically allocate memory for the structure and for the array. matrixCopy copies one matrix into another. there are functions to subtract, add and multiply matrices that return a pointer to memory where the …

Member Avatar for Thaylo
0
1K
Member Avatar for halil.burak

Frame complete game, only the outer edges of a square drawn on the table is a game played with 2 players. Sequence of a square drawn from the player wants to draw a non-edge. Underline that this edge of the square is not the last edge of the square is …

0
122
Member Avatar for natha_peepli

i wann multiply two matrix but the part of given code is not working...i wanna input the value from the user using pointers.. [CODE]#include<stdio.h> #include<conio.h> void main() { printf("This is matrix multiplication program"); printf("\nEnter the dimensions of two array "); int Row1 = 0, Col1 = 0, Row2 = 0, …

Member Avatar for myk45
0
246
Member Avatar for Hawkeye Python

Hello :) I'm from Brazil, so sorry about my english. This is the first code I post here - I'm a begginer in Python. It is a function to calculate determinants of matrices. You can attach it to a class if you wish. Please leave a comment if you wish …

Member Avatar for Gribouillis
0
3K
Member Avatar for tKc

Hokay so, i gotta make a program that reads an adjacency matrix from a data file and then outputs which nodes are adjacent to the others. In the data file there are 0's and 1's, 0 means that they are not connected and a 1 means that they are. I …

Member Avatar for mrnutty
0
482
Member Avatar for bookmark

Hi, I'm trying to get this program to read a file which contains a matrix. I am trying to output a text file which has the matrix of the input file but with the average of each row. Every time I enter the name of the inputFile and the outputFile …

Member Avatar for Fbody
0
210
Member Avatar for digitaldan

Hello All, I wrote the following code to access a file, assign pointers to the contents of the file, display the file as a matrix, read the last line as a separate matrix, then I am supposed to perform matrix multiplication on the two aforementioned matricies. I have the first …

Member Avatar for digitaldan
0
193
Member Avatar for sharkpit

this is the summary of program and i only include the addition of matrices my problem would be the variables in Addition class cannot read variables from the other class i need to know how to fix that the error would be : The name 'a' does not exist in …

Member Avatar for Mitja Bonca
0
125
Member Avatar for sallubhai

Hi, How can I print this figure if I have an array like this? It should be a for-loop but don´t know how. [CODE] labyrinth = \ [[0,0,0,0,0,0,1,0], [0,1,0,1,1,1,1,0], [0,1,1,1,0,1,0,0], [0,1,0,0,0,0,0,0], [0,1,1,0,1,1,1,0], [0,0,1,1,1,0,0,0], [0,1,1,0,1,1,1,0], [0,1,0,0,0,0,0,0]] [/CODE] figure: ############. ## ## ##. . . . ## ##. . . ## #### …

Member Avatar for TrustyTony
0
154
Member Avatar for Hi-Tone

Dear all, Im trying to do a matrix multiplication with complex number. I have 2 structures: [code=c] /* Structures */ typedef struct complex { // Complex structure = real and imaginary part. double re; double im; } Complex; typedef struct complex_matrix { int rows; int cols; Complex **mat; } Complex_Matrix; …

0
32
Member Avatar for yigster

[CODE]namespace week4Matrix { class Program { int[,] a; int[,] b; int[,] c; static void Main(string[] args) { } public void TransposeMatrix() { for (int i = 0; i < a.GetLength(0); i++) { for (int j = 0; j < a.GetLength(1); j++) { c[j, i] = a[i, j]; } } } …

0
61
Member Avatar for RobBobSmith

Hello all, I'm having trouble with making a 2d vector array class. Would anyone have time to help with a couple of questions? I think my problem is with overloading (). I notice that this: [CODE]template <typename T> T& Array2d<T>::operator() ( int x, int y) { if( x >= rows …

Member Avatar for RobBobSmith
0
190
Member Avatar for cmb2thim

could you please help me? i need to write a program, no dynamic allocation, using classes and arrays to multiply only 3x3 matrices only

Member Avatar for daviddoria
0
61
Member Avatar for Caeon

This is what my program is supposed to do: [LIST=1] [*]Print the vector (m1) [*]Print the matrix (m2) [*]Multiply the vector and matrix together and display results [/LIST] The only thing wrong with my program is that I can't quite get the right results displayed. The correct display of values …

Member Avatar for Caeon
0
12K
Member Avatar for kuchick32

[code] #include <fstream> #include <iostream> #include <cstdlib> using namespace std; int main () { char out_file_name[15]; cout<<"Enter the name of your output file: "; cin>>out_file_name; ifstream input; ofstream output; cout<<"Begin editing files.\n"; input.open("Input.txt"); if (input.fail()) { cout<<"Input file opening failed.\n"; exit(1); } output.open("output.txt"); if(output.fail()) { cout<<"Output file opening failed.\n"; exit(1); …

Member Avatar for kuchick32
0
189
Member Avatar for Goshutu

my program is made to enter a matix,in which it finds all of the column`s minimum numbers which are[COLOR="Red"] >0[/COLOR] and then put them under the last row.i have sucseded entering the array and puting it out,but i think my IF is wrong somehow.I have tried initialising the last row …

Member Avatar for Goshutu
0
204
Member Avatar for kirennian

I'm currently having an issue with moving the camera around the z-axis (roll). For debugging purposes, I have an object with which I've tested with all 3-axis rotation and movement and it's working as expected; the object in question as well as the camera class superseed a positions class for …

Member Avatar for dineshguru
0
1K
Member Avatar for matkod

hi, I'm creating a game with pygame and i want to create a matrix that will represent the map(where each tile will be). my pygame code is ok, because if i create the map without loading the tilemap (the matrix file) the game runs ok. that would be good but …

Member Avatar for Gribouillis
0
185
Member Avatar for thm

I'm trying to write a matrix multiplication program that takes in an int N on command line, creates two NxN matrices A & B, randomly populates them with ints, and then computes the result of multiplying A and B. I wanted to avoid malloc, but the first version started segfaulting …

Member Avatar for thm
0
323
Member Avatar for bflack

Given the matrix representing a relation on a finite set, determine whether the relation is reflexive or irreflexive.. Need your help!

Member Avatar for bflack
0
493
Member Avatar for bflack
0
80
Member Avatar for myk45

Hello. For 2D matrix multiplication, i tried a new method, which uses only 2 for loops. (im basically using a 1D array to access the elements). Here is the code: // Mutiplication.cpp : Defines the entry point for the console application. // [CODE]#include <stdio.h> int main(void) { int a[] = …

Member Avatar for myk45
0
132
Member Avatar for JoonYup

Hello, I'm trying to write a program for matrix multiplication I keep getting an error.... Please help [code] class Matrix { private int numRows, numColumns; private double x[][]; public Matrix(int m, int n){ numRows = m; numColumns = n; x = new double[numRows][numColumns]; for(int i = 0; i < numRows; …

Member Avatar for masijade
0
106
Member Avatar for applepomme

for (i=0, i<imax, i++) { // ... Array< complex<float>, 3 > matrix(x,y,z); // x,y,z are large and vary in each loop // ... // matrix <=== values for each element assigned // ... // now want to write "matrix" in a single binary file. // later, this matrix can be …

Member Avatar for chiwawa10
0
191
Member Avatar for applepomme

I used this to write the matrix into a file: int Nx, Ny, Nz; Array <complex<float>, 3> matrix(Nx, Ny, Nz, ColumnMajorArray<3>()); ...get matrix data... fstream outbin(outname.c_str(),ios::out|ios::binary); outbin.write(reinterpret_cast<char *>(matrix.data()),sizeof(complex<float>)*Nx*Ny*Nz); outbin.close(); Then, I used this to read this matrix, works fine, values and orders are correct too: Array <complex<float>, 3> matrixb(Nx, Ny, …

0
85
Member Avatar for marvin42

I am using [URL="http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.aspx"]matrix class[/URL] to perform image transformations.Problem is that I want to do a perspective transform, which requires a 3x3 matrix. [COLOR="Green"]system.drawing.drawing2d.matrix[/COLOR] behaves like a 3x2 matrix. Here's a short code extract of what I use the matrix for: [CODE] Graphics my_graphics= Graphics.FromImage(my_image); my_graphics.Transform = my_matrix; my_graphics.DrawImage(my_image2, new …

Member Avatar for Momerath
0
187
Member Avatar for guru_iyer

I'm trying to do addition of matrices using pointers. But, in 3x3 matrix, only the first row of the matrix gets added, while the rest are zero. Please help me correct this. Thank You! My code is as follows :: [CODE] #include<stdio.h> #include<conio.h> int a[10][10],b[10][10],c[10][10]={0}; int i=0,j=0,k=0; int r1,c1,r2,c2; void …

Member Avatar for Adak
0
3K
Member Avatar for korde

sir i want to multiply two matrix 3-by-3 using recursion function please send me source code on mail address <<snip>> thanking you

Member Avatar for Duki
-1
42

The End.