Tuesday, July 14, 2009

How do I create a sparse 3D matrix in C++?

I need to create a matrix of size (256, 256, 256) on which I can perform some mathematical operations. Usually I have been using Boost uBLAS for matrix math, but I don't think I can create a 3D matrix there. I tried using an int Array[256][256][256] but this was way too large and I experienced a stack overflow.

How do I create a sparse 3D matrix in C++?
Well, it is easier than you think. You have to allocate memory, either statically or dynamically on the heap to hold the variable. It is far too big for use as an auto allocation at 256*256*256*(sizeof [variable type]); or about


16,777,216*4 bytes at a minimum, over 64 MB of RAM. A better idea than a matrix may be to keep only boundary or center point coordinate triples in memory and assume that they are on an empty grid. This way a sphere can be defined as an object with a radius r and a center point triple (x,y,z). A box becomes a set of two ordered triples, (x,y,z) that represents the two opposite corners in three space. This will save quite a bit of space.


If a matrix is still required, then you need to allocate as small a matrix as possible and allocate and deallocate memory for the variable arrays at appropriate points in the program. In C++, this can be done most efficiently with the keywords new and delete. I hope that this helps you out. Below are a couple of good forum sites with tutorials and articles.


I have a '94 T-Bird S.C. and am having problems with E.P.T. if someone can 1 on 1 get back?

I got a comp scan and it read Knock sensor and EPT. my tubes seem fine and i have been running oct. boost to make up for todays ragedy fuels what do i do about the ept?is it fixable with duct tape?LOL

I have a '94 T-Bird S.C. and am having problems with E.P.T. if someone can 1 on 1 get back?
these guys can help you http://www.sccoa.com/forums/


The department of labor encouraged me to attend a safety officer training w/c is $215 reg fee,is is worth it?

Th catch is, im leaving the company in 3months time. meaning, i dont want the company to spend money for the training yet im leaving. The department of labor said that it will boost my career if I become a Safety Officer. I am an HR Practioner.





Is it worth it to shoulder personally the training fee just to be a Safety Officer? I mean will it really give boost to my career?





thanks!!!

The department of labor encouraged me to attend a safety officer training w/c is $215 reg fee,is is worth it?
Two things: how much do you trust the department of labor? Do you suppose they might know something about the job market?


Secondly, if nothing else, you might be able to deduct the cost of the class on taxes as job training expense.


Since we really don't know what your career is, it is difficult to be more specific.


Baby boy names that start with a "C" or "T"?

My head is hurting because all of the baby boy names I like, someone in either me or my hubby's family has the name already! What do you guys think about naming your child after an uncle or cousin or something? My first son is already named after his father. I just need a little name boost! Thank you!

Baby boy names that start with a "C" or "T"?
cabrera, cade, caden, cadmus, cailen, cain, cal, caleb, calvin, cam camden, cameron, camron, carlin, carlos, carson, cart, carter, casey, cassidy, cavan, chad, chaney, chase, charlie, chauncey, christian, christopher, cimarron, clancy, clay, coby, colson, connor, corey, coty, clayton, cutler,


Travis, tayton, tedrick, tegan, terry, therman, thomas, thompson, timmy, tim, timothy todd, toby,tom, trae, trenton, ty, turner, tyce, tyson
Reply:cornholio
Reply:Cash


Titan
Reply:Connor, Collin, Casey, Chris, Christian, Corey, Caleb, Caylex, Camron


Tim, Taylor, Tanner, Trevor, Tyler, Tony, Tommy, Tad.
Reply:Carson is my favorite name! I also like Tyler.
Reply:Trevon, Talon, Curtis, Chad, Tyler
Reply:Tyson


Thad


Taylor





Cason


Cody


Cameron
Reply:I like alot of 'C' names:


Colin


Connor


Caleb


Corbin


Caiden
Reply:name him cassidy
Reply:"C names" : http://allnames.org/first_name_c.html


"T names": http://allnames.org/first_name_t.html
Reply:Telny- means harp





Cade- sturdy





Caelan- slender lad





Taban- shininnig
Reply:When i have kids I'm naming my son after my Dad.
Reply:I like the name Colin, but Toby, Caleb, Colton, Cyrus, Twain, Terah, Tyre
Reply:I think that naming your baby after a cousin or uncle should only be done if you are really close to them. Close to them like you would be to your father or father in law. I think COLTEN is a cute baby boys name. Collin, Terrance, Toby, thats all I can think of now. Hope that helps ya.
Reply:Charlie


Cash is cute
Reply:Chad or Tookie
Reply:Conner.
Reply:Carl Tomas
Reply:Carlos


Carl


Conway
Reply:Cory


Curt


Christopher


Collin


Conner


Caleb











Timothy


Toby


Tyler


Thomas


Teddy


Topher





I think it is good to name them after ANYONE who means alot in your life.





Good luck.
Reply:Trevor! and Conner! My two favorite guys, my son and my grandson.
Reply:Tray, Chris, Cory, Chase, Tyler, Tony, Tom
Reply:Christian or Trevor
Reply:Tyler, Taylor, Tevin, Trevor, Thaddeus, Tad, Tameron, Troy, Tanner, Todd, Travis, Tarik


Cody, Coty, Caleb, Conner, Cole, Chandler, Clye, Clayton, Creg,Clint, Cameron, Courtney (male/female),
Reply:chad


thomas
Reply:how about caleb conner christopher or taylor thomas trinity ??
Reply:cody charlie connor cain thomas tristan toby tyler
Reply:I'm not into naming your kids the same name as others in the family. In mine we have about 5 people with the name "James" (or some variant). It gets confusing.


Some boy names with a "C": Colby, Cedric


"T": Tanner, Thomas


And I'll throw in a "J": Jaden


Good luck finding a name! :)
Reply:Carlos, Christopher, Tanner
Reply:Terrin Carey troy chris tim
Reply:I myself don believe you should name your child after family member, especially the father, because what do you do if you have more kids, they will fill un special because thier not named after daddy, but thats a closed deal of coure and if you named the first after the dad, then by all means name the other after the other family.





tanner


carlton


toby


why does it have to be t or c ? i love the dawson! luke is cute to, tressy


treston(-now that is cute-thats my little cousins name!)


get a baby name book

hawthorn

BIRTH CONTROL&PREGNANCY..would going back on b.c. 4 a few months jumpstart fertility???

I have been off the pill for almost 3 years now, not necessarily trying to get pregnant.. but kind of hoping. My hubby and I are both really wanting a baby and haven't been using any protection at all since I quit the pill. I have a 7 yr. old son from a prev relationship, he's never had kids. We both take good care of ourselves, and I've recently lost about 30 lbs in hopes of conceiving. My question is: what if I started the pill again for 6 mos or so.. then quit taking it? Would it boost my fertility? I really want to fully commit to a natural conception as long as I can. I'm willing to try anything short of prescription drugs and multiple dr.s visits. Any help would be well... helpful! Thanks!!!

BIRTH CONTROL%26amp;PREGNANCY..would going back on b.c. 4 a few months jumpstart fertility???
The bcp usually regualtes the period.
Reply:yes it will


Do nursing homes really help you acquire a C.N.A. certificate?

I am looking for a way to help others and be happy. I heard about certified nursing assistants. People work at nursing homes and sometimes acquire their certificate there to help boost the amount of CNAs. Do you know of any links for this? I did an online search for nursing homes but they seem to want experienced people working for them. Any advice?

Do nursing homes really help you acquire a C.N.A. certificate?
Check with the nursing homes in your area, many homes do have programs to get your cna. Another idea is to look at the state board of health website for your state, they frequently have listings of places to go to get certified.
Reply:yes, Nursing homes will pay for you to get your CNA license.


You will have to check with the Nursing homes in your area.


Can homeopathic or natural medicines treat hepititis c geno type 3a completely?

if yes can i get some advice as how to proceed and how much time it may take to treat the patient.Any medicines to boost immunity in place of inferon injections.

Can homeopathic or natural medicines treat hepititis c geno type 3a completely?
Hi Health





Here are some ideas to heal your condition.





Cause


The most common cause of hepatitis is a virus that can occur in five potential forms: A, B, C, D, or E. Other causes include excessive alcohol consumption, drug abuse (including pharmaceutical drugs, such as acetaminophen), overexposure to chemicals, and, sometimes, as a reaction to properly prescribed medications.





In recent years, hepatitis C has been on the increase. It is most frequently caused as a result of blood transfusions. Typically, people with hepatitis C are identified either because they have abnormal liver tests or because of a hepatitis C antibody test. A positive test does not necessarily mean serious liver disease, however. People with hepatitis C may have no liver disease, a mild form of chronic hepatitis, or a more serious form of hepatitis that may progress over a number of years to cirrhosis. The usual indications are a positive antibody test for the hepatitis C virus, abnormal liver tests for more than six to twelve months, and a liver biopsy that shows chronic active hepatitis. Approximately 20% of patients chronically infected with the hepatitis C virus will go on to develop cirrhosis.





Note: Infectious hepatitis can be easily spread two weeks before and one week after jaundice appears. The feces of people with hepatitis contain the virus. Therefore, very strict toilet hygiene and hand and cloth washing should be observed during this time.








--------------------------------------...





Natural Cures





Aromatherapy: Rosemary can help stimulate liver function.





Diet: Follow a diet low in protein and high in fresh vegetables to minimize stress on the liver. Also eat small meals throughout the day, and avoid foods such as refined sugars, alcohol, and caffeine, which cause stress on the liver, and be sure to drink plenty of filtered water. Drinking fresh lemon juice water every morning and evening followed by vegetable juice is also recommended to help liver function. Easily digested grains, such as millet, buckwheat, and quinoa, are also good food choices.





Enemas: Three warm enemas administered daily can help boost liver function. Do a colon and liver cleanse.





Herbs: The liver-cell regenerative properties of herbs such as milk thistle and licorice can be helpful. Take 1/2 teaspoon of this mixture three times a day. Tumeric combined with milk thistle has also been shown to help alleviate the symptoms of hepatitis B.





Hydrotherapy: Hydrotherapy is the application of water, ice, steam and hot and cold temperatures to maintain and restore health. Treatments include full body immersion, steam baths, saunas, sitz baths, colonic irrigation and the application of hot and/or cold compresses. Hydrotherapy is effective for treating a wide range of conditions and can easily be used in the home as part of a self-care program. Many Naturopathic Physicians, Physical Therapists and Day Spas use Hydrotherapy as part of treatment. I suggest several at-home hydrotherapy treatments.





Juice Therapy: The following juice combinations can be helpful: beet, carrot, and wheat grass juice; or garlic, burdock, flax, and black currants.





Nutritional Supplementation: Supplement with vitamin C, beta carotene, liver glandulars, milk thistle extract, vitamin B complex, adrenal glandulars, lipotropic factors, pantothenic acid, free-form amino acids, betaine hydrochloric acid (HCL), multi-enzymes, and evening primrose oil.





Alternative Professional Care


If your symptoms persist despite the above measures, seek the help of a qualified health professional. The following professional care therapies have all been shown to be useful for treating hepatitis: Ayurveda, Acupuncture, Detoxification Therapy, Magnetic Field Therapy, Naturopathic Medicine, and Oxygen Therapy.





Best of health to you
Reply:http://www.biomedx.com/urine/





It's called urine therapy, but it's not for everyone. Check it out at least, it won't hurt to have a look.