473,466 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

matrix indexes

4 New Member
I wanted to use matrixs in awk and got some problem, here is some of the script code, from the BEGIN tag:
Expand|Select|Wrap|Line Numbers
  1. row_char[1]="a";row_char[2]="b";row_char[3]="c";row_char[4]="d";row_char[5]="e"$
  2. row_char[8]="h";row_char[9]="i";row_char[10]="j";row_char[11]="k";
  3. # from the proccess passage:
  4. sentence[varchar[11],1]=1;
  5. diffrence=4;
  6. i=7;
  7. sum_index=diffrence+i;
  8. printf("test: %d",sentence[row_char[11],1]); # it prints that like it should be test: 1
  9. printf("test2: %d",sentence[row_char[sum_index],1]); # here it prints test2: 0 that does not right.
  10.  
I almost sure the problem is the form of the array index ,as in awk probably there is no matrixs.
Please help me with this.
Oct 26 '08 #1
4 1973
Nepomuk
3,112 Recognized Expert Specialist
Hi tal23! Welcome to bytes.com!

It's great to have you here!

When you post, please always keep to the Posting Guidelines and when you post code, please post it in [code] ... [/code] tags. In this case I added them for you - your question was very difficult to read without them.

I'm sorry to say, that I can't help you with your question, but I'm sure someone will.

Otherwise, I'll just wish you the best and hope you enjoy being part of bytes.com!

Greetings,
Nepomuk (Moderator)
Oct 27 '08 #2
tal23
4 New Member
That is only a passages from the script but it can run like a script even in this shape.
the important part from the begin passage:
Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2. {
  3. row_char[1]="a";row_char[2]="b";row_char[3]="c";row_char[4]="d";row_char[5]="e"$ 
  4. row_char[8]="h";row_char[9]="i";row_char[10]="j";row_char[11]="k"; 
  5. }
  6. # from the proccess passage: 
  7. {
  8. sentence[varchar[11],1]=1; 
  9. diffrence=4; 
  10. i=7; 
  11. sum_index=diffrence+i; 
  12. printf("test: %d",sentence[row_char[11],1]); # it prints that like it should be test: 1 
  13. printf("test2: %d",sentence[row_char[sum_index],1]); # here it prints test2: 0 that does not right. 
  14. }
The problem i need to solve is the value that been printed in the two printf sentences one showes a right result and one wrong but i must use the syntax of the second
Oct 28 '08 #3
Nepomuk
3,112 Recognized Expert Specialist
Hi!
As I said before, please use the [CODE]...[/code] tags when posting code - just put the word [CODE] before your code and [/code] after it. Alternatively, use the # button in the message box. I've added those tags for you twice in this thread now.

Now, about your question: Try printing the value of sum_index - is it really 11, as it should be? I don't see any reason, why it shouldn't be, but you never know...

Greetings,
Nepomuk
Oct 28 '08 #4
tal23
4 New Member
It has that value for sure.
Oct 29 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
5
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more...
3
by: Jack Middleton | last post by:
Hi! I'm lookin for a faster permutation algorithm for matrices. I know that it can be done with multiplying a matrix with a permutation matrix. It just seems a waste to iterate through all those...
4
by: Paul H | last post by:
OK, I tried getting and old Newbury Data ND2500 working using the "Generic /Text only" driver in Win XP. It prints, but I could not find a way to set a custom page size that matches the paper I am...
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
1
by: Peterwkc | last post by:
Hello all expert, i have two program which make me desperate bu after i have noticed the forum, my future is become brightness back. By the way, my problem is like this i the first program was...
2
by: DarrenWeber | last post by:
Below is a module (matrix.py) with a class to implement some basic matrix operations on a 2D list. Some things puzzle me about the best way to do this (please don't refer to scipy, numpy and...
0
by: DarrenWeber | last post by:
# Copyright (C) 2007 Darren Lee Weber # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free...
10
by: Babak | last post by:
Hi, I've developed a C program which contains a large number of vectors and matrices operations. Throughout my code, I used the template from the Numerical Recipes book to define vectors and...
2
by: rijaalu | last post by:
I am designing a matrix class that performs addition, multicpication, substraction and division. When ever i complie the code it shows an error. include <iostream> using namespace std; class...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.