Weight and salt analysis-from the mathematical and computer Perspectives (8)

Source: Internet
Author: User

This blog (http://blog.csdn.net/livelylittlefish) posted the author (a wave) related research, learning content of the Notes, welcome to the majority of friends correct!

 

 

Content

0. Problem

1. Some methods

2. Mathematical Analysis

3. Can I Program Computing?

4. An improved method

5. Methods for further improvement

6. Can I directly calculate and find all the correct solutions?

7. A Simpler Method

8. automatic compilation and running of all codes

8.1 how to automatically compile?

8.2 how to automatically run and save results?

9. Problem Expansion

10. Experience

11. Conclusion

Reference

Appendix 1: Mathematical decomposition code weight1.c

Appendix 2: execution result of the mathematical decomposition program weight1

Appendix 3: weight2.c

Appendix 4: code for the improved method weight3.1.c/3.2.c/3.3.c

Appendix 5: The output result of weight3.1.c/3.2.c/3.3.c

Appendix 6: directly calculate the correct decomposition code weight4.c

Appendix 7: code for a simpler method weight5.1.c/5.2.c/5.3.c


8. automatic compilation and running of all codes

 

8.1 how to automatically compile?

 

To automatically compile all the sample code, you can easily think of the MAKEFILE file. For more information about how to write makefile, see write makefile with me, control makefile, and compile makefile. For this example, the MAKEFILE file written by the author is as follows.

CC = gccCXXFLAGS += -g -Wall -WextraTARGET = weight1 weight2 weight3.1 weight3.2 weight3.3 weight4 weight5.1 weight5.2 weight5.3CLEANUP = rm -f $(TARGET) *.oall : $(TARGET)clean :$(CLEANUP)weight1.o: weight1.c$(CC) $(CXXFLAGS) -c $^weight2.o: weight2.c$(CC) $(CXXFLAGS) -c $^weight3.1.o: weight3.1.c$(CC) $(CXXFLAGS) -c $^weight3.2.o: weight3.2.c$(CC) $(CXXFLAGS) -c $^weight3.3.o: weight3.3.c$(CC) $(CXXFLAGS) -c $^weight4.o: weight4.c$(CC) $(CXXFLAGS) -c $^weight5.1.o: weight5.1.c$(CC) $(CXXFLAGS) -c $^weight5.2.o: weight5.2.c$(CC) $(CXXFLAGS) -c $^weight5.3.o: weight5.3.c$(CC) $(CXXFLAGS) -c $^all:weight1: weight1.o$(CC) $(CXXFLAGS) $^ -o $@weight2: weight2.o$(CC) $(CXXFLAGS) $^ -o $@weight3.1: weight3.1.o$(CC) $(CXXFLAGS) $^ -o $@weight3.2: weight3.2.o$(CC) $(CXXFLAGS) $^ -o $@weight3.3: weight3.3.o$(CC) $(CXXFLAGS) $^ -o $@weight4: weight4.o$(CC) $(CXXFLAGS) $^ -o $@weight5.1.o: weight5.1.c$(CC) $(CXXFLAGS) -c $^weight5.2.o: weight5.2.c$(CC) $(CXXFLAGS) -c $^weight5.3.o: weight5.3.c$(CC) $(CXXFLAGS) -c $^rm -f *.o

8.2 how to automatically run and save results?

 

The script autorun.sh of the compile, write, run, and save the result to the TXT file with the same name, as shown below.

echo -e "start to run all examples\n"echo "weight1 running ..."./weight1 > weight1.txtecho "    result is in weight1.txt"echo "weight2 running ..."./weight2 > weight2.txtecho "    result is in weight2.txt"echo "weight3.1 running ..."./weight3.1 > weight3.1.txtecho "    result is in weight3.1.txt"echo "weight3.2 running ..."./weight3.2 > weight3.2.txtecho "    result is in weight3.2.txt"echo "weight3.3 running ..."./weight3.3 > weight3.3.txtecho "    result is in weight3.3.txt"echo "weight4 running ..."./weight4 > weight4.txtecho "    result is in weight4.txt\n"echo "weight5.1 running ..."./weight5.1 > weight5.1.txtecho "    result is in weight5.1.txt"echo "weight5.2 running ..."./weight5.2 > weight5.2.txtecho "    result is in weight5.2.txt"echo "weight5.3 running ..."./weight5.3 > weight5.3.txtecho "    result is in weight5.3.txt"echo "done. bye."

Next section of the previous section

Thinking questions, tree structure, weight and salt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.